Improve supervisor debug logging

Mainly making stem process debug messages sent up to parent supervisor
process and included in its debug.log though option to print to stderr
remains in form of environment variable in case debugging breaking
change to the IPC mechanism itself.
This commit is contained in:
Jon Siwek 2020-01-14 11:24:46 -08:00
parent 0ff99c3df8
commit 80b3aef486
3 changed files with 95 additions and 40 deletions

View file

@ -1067,17 +1067,11 @@ int main(int argc, char** argv)
if ( options.debug_log_streams )
{
debug_logger.EnableStreams(options.debug_log_streams->data());
const char* debug_log_name = nullptr;
if ( ! getenv("ZEEK_DEBUG_LOG_STDERR") )
{
if ( is_supervisor(options) )
debug_log_name = "debug-supervisor";
else
debug_log_name = "debug";
}
debug_logger.OpenDebugLog(debug_log_name);
if ( getenv("ZEEK_DEBUG_LOG_STDERR") )
debug_logger.OpenDebugLog(nullptr);
else
debug_logger.OpenDebugLog("debug");
}
#endif