mirror of
https://github.com/zeek/zeek.git
synced 2025-10-11 19:18:19 +00:00

- Moving all functions into the Log::* namespace, using the recent bifcl updates. Moved logging-specific stuff to logging.bif. - Log::create_stream() now takes a record Log::Stream as its second argument, which specifies columns and (optionally) the event. - All the internal BiFs are now called "Log::__<something>", with script-level wrappers "Log::<something>". That first allows to add additional code at the script-level, and second makes things better comprehendible as now all relevant functionality is collected (and later documetned) in policy/logging.bro. - New function Log::flush(id), which does the obvious assuming the writer supports it. - add_default_filter() is now called implicitly with every create_stream(). Seems that we usually want that functionality, and when not, remove_default_filter() gets rid of it. - The namespace of a stream's ID is now used as the default "path" (e.g., if the namespace is SSH, the default log file is "ssh.log"). - Updated policy/test-logging.bro as well as the btest tests according to these changes.
30 lines
627 B
C++
30 lines
627 B
C++
//
|
|
// Log writer for tab-separated ASCII logs.
|
|
//
|
|
|
|
#ifndef LOGWRITERASCII_H
|
|
#define LOGWRITERASCII_H
|
|
|
|
#include "LogWriter.h"
|
|
|
|
class LogWriterAscii : public LogWriter {
|
|
public:
|
|
LogWriterAscii();
|
|
~LogWriterAscii();
|
|
|
|
static LogWriter* Instantiate() { return new LogWriterAscii; }
|
|
|
|
protected:
|
|
virtual bool DoInit(string path, int num_fields, LogField** fields);
|
|
virtual bool DoWrite(int num_fields, LogField** fields, LogVal** vals);
|
|
virtual bool DoSetBuf(bool enabled);
|
|
virtual bool DoRotate(string rotated_path);
|
|
virtual bool DoFlush();
|
|
virtual void DoFinish();
|
|
|
|
private:
|
|
FILE* file;
|
|
char* fname;
|
|
};
|
|
|
|
#endif
|