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

@ -755,6 +755,8 @@ int main(int argc, char** argv)
#ifdef DEBUG
if ( debug_streams )
debug_logger.EnableStreams(debug_streams);
debug_logger.OpenDebugLog("debug");
#endif
init_random_seed(seed, (seed_load_file && *seed_load_file ? seed_load_file : 0) , seed_save_file);