mirror of
https://github.com/zeek/zeek.git
synced 2025-10-05 16:18:19 +00:00
Test case for a dynamic log writer.
This commit is contained in:
parent
aa731eeaec
commit
f45526f373
9 changed files with 159 additions and 1 deletions
31
testing/btest/plugins/writer-plugin/src/Foo.cc
Normal file
31
testing/btest/plugins/writer-plugin/src/Foo.cc
Normal file
|
@ -0,0 +1,31 @@
|
|||
|
||||
#include "Foo.h"
|
||||
|
||||
using namespace logging;
|
||||
using namespace writer;
|
||||
|
||||
bool Foo::DoInit(const WriterInfo& info, int num_fields,
|
||||
const threading::Field* const * fields)
|
||||
{
|
||||
desc.EnableEscaping();
|
||||
desc.AddEscapeSequence("|");
|
||||
threading::formatter::Ascii::SeparatorInfo sep_info("|", ",", "-", "");
|
||||
formatter = new threading::formatter::Ascii(this, sep_info);
|
||||
path = info.path;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Foo::DoWrite(int num_fields, const threading::Field* const* fields,
|
||||
threading::Value** vals)
|
||||
{
|
||||
desc.Clear();
|
||||
|
||||
if ( ! formatter->Describe(&desc, num_fields, fields, vals) )
|
||||
return false;
|
||||
|
||||
printf("[%s] %s\n", path.c_str(), desc.Description());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue