mirror of
https://github.com/zeek/zeek.git
synced 2025-10-04 15:48:19 +00:00
34 lines
803 B
C++
34 lines
803 B
C++
|
|
#include "Foo.h"
|
|
|
|
using namespace btest::logging::writer;
|
|
|
|
Foo::~Foo()
|
|
{
|
|
delete formatter;
|
|
}
|
|
|
|
bool Foo::DoInit(const zeek::logging::WriterBackend::WriterInfo& info, int num_fields,
|
|
const zeek::threading::Field* const * fields)
|
|
{
|
|
desc.EnableEscaping();
|
|
desc.AddEscapeSequence("|");
|
|
zeek::threading::formatter::Ascii::SeparatorInfo sep_info("|", ",", "-", "");
|
|
formatter = new zeek::threading::formatter::Ascii(this, sep_info);
|
|
path = info.path;
|
|
|
|
return true;
|
|
}
|
|
|
|
bool Foo::DoWrite(int num_fields, const zeek::threading::Field* const* fields,
|
|
zeek::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;
|
|
}
|