Don't create debug.log immediately upon startup

Instead of creating the debug.log immediately when bro starts,
now it is created only after the debug streams are enabled.
This avoids having an empty log being created when it shouldn't be,
in usages such as "bro -h", "bro -v", or "bro -B help" (and also
when using broctl, which needs to run "bro -v").
This commit is contained in:
Daniel Thayer 2016-06-04 17:16:25 -05:00
parent 8c54f91617
commit 0cae2ca003
3 changed files with 18 additions and 11 deletions

View file

@ -53,9 +53,11 @@ namespace plugin { class Plugin; }
class DebugLogger {
public:
// Output goes to stderr per default.
DebugLogger(const char* filename = 0);
DebugLogger();
~DebugLogger();
void OpenDebugLog(const char* filename = 0);
void Log(DebugStream stream, const char* fmt, ...);
void Log(const plugin::Plugin& plugin, const char* fmt, ...);