Change reporter messages to more reliably print to stderr.

Moved this functionality to be internal instead of in the script-layer
event handlers.  The issue with the later is that bad things can happen
between the time a reporter event handler is dispatched and the time it
is executed, and if bro crashes in that time, the message may never be
seen/logged.

Addressed #930 (and revisits #836).
This commit is contained in:
Jon Siwek 2013-01-18 12:46:00 -06:00
parent 2823744ea5
commit fdd11428c1
11 changed files with 90 additions and 64 deletions

View file

@ -43,6 +43,9 @@ public:
Reporter();
~Reporter();
// Initialize reporter-sepcific options that are defined in script-layer.
void InitOptions();
// Report an informational message, nothing that needs specific
// attention.
void Info(const char* fmt, ...) FMT_ATTR;
@ -126,6 +129,9 @@ private:
int errors;
bool via_events;
int in_error_handler;
bool info_to_stderr;
bool warnings_to_stderr;
bool errors_to_stderr;
std::list<std::pair<const Location*, const Location*> > locations;
};