mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
Checkpointing the dynamic plugin code.
This is essentially the code from the dynamic-plugin branch except for some pieces that I have split out into separate, earlier commits. I'm going to updatre things in this branch going forward.
This commit is contained in:
parent
7412470d66
commit
555df1e7ea
43 changed files with 1306 additions and 110 deletions
|
@ -5,6 +5,7 @@
|
|||
|
||||
#include "DebugLogger.h"
|
||||
#include "Net.h"
|
||||
#include "plugin/Plugin.h"
|
||||
|
||||
DebugLogger debug_logger("debug");
|
||||
|
||||
|
@ -73,10 +74,12 @@ void DebugLogger::EnableStreams(const char* s)
|
|||
{
|
||||
if ( strcasecmp("verbose", tok) == 0 )
|
||||
verbose = true;
|
||||
else
|
||||
else if ( strncmp(tok, "plugin-", 7) != 0 )
|
||||
reporter->FatalError("unknown debug stream %s\n", tok);
|
||||
}
|
||||
|
||||
enabled_streams.insert(tok);
|
||||
|
||||
tok = strtok(0, ",");
|
||||
}
|
||||
|
||||
|
@ -105,4 +108,24 @@ void DebugLogger::Log(DebugStream stream, const char* fmt, ...)
|
|||
fflush(file);
|
||||
}
|
||||
|
||||
void DebugLogger::Log(const plugin::Plugin& plugin, const char* fmt, ...)
|
||||
{
|
||||
string tok = string("plugin-") + plugin.Name();
|
||||
tok = strreplace(tok, "::", "-");
|
||||
|
||||
if ( enabled_streams.find(tok) == enabled_streams.end() )
|
||||
return;
|
||||
|
||||
fprintf(file, "%17.06f/%17.06f [plugin %s] ",
|
||||
network_time, current_time(true), plugin.Name());
|
||||
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
vfprintf(file, fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
fputc('\n', file);
|
||||
fflush(file);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue