mirror of
https://github.com/zeek/zeek.git
synced 2025-10-04 15:48:19 +00:00
Reformat Zeek in Spicy style
This largely copies over Spicy's `.clang-format` configuration file. The one place where we deviate is header include order since Zeek depends on headers being included in a certain order.
This commit is contained in:
parent
7b8e7ed72c
commit
f5a76c1aed
786 changed files with 131714 additions and 153609 deletions
|
@ -11,78 +11,73 @@
|
|||
#include "zeek/threading/formatters/Ascii.h"
|
||||
#include "zeek/threading/formatters/JSON.h"
|
||||
|
||||
namespace zeek::plugin::detail::Zeek_AsciiWriter
|
||||
{
|
||||
namespace zeek::plugin::detail::Zeek_AsciiWriter {
|
||||
class Plugin;
|
||||
}
|
||||
}
|
||||
|
||||
namespace zeek::logging::writer::detail
|
||||
{
|
||||
namespace zeek::logging::writer::detail {
|
||||
|
||||
class Ascii : public WriterBackend
|
||||
{
|
||||
class Ascii : public WriterBackend {
|
||||
public:
|
||||
explicit Ascii(WriterFrontend* frontend);
|
||||
~Ascii() override;
|
||||
explicit Ascii(WriterFrontend* frontend);
|
||||
~Ascii() override;
|
||||
|
||||
static std::string LogExt();
|
||||
static std::string LogExt();
|
||||
|
||||
static WriterBackend* Instantiate(WriterFrontend* frontend) { return new Ascii(frontend); }
|
||||
static WriterBackend* Instantiate(WriterFrontend* frontend) { return new Ascii(frontend); }
|
||||
|
||||
protected:
|
||||
bool DoInit(const WriterInfo& info, int num_fields,
|
||||
const threading::Field* const* fields) override;
|
||||
bool DoWrite(int num_fields, const threading::Field* const* fields,
|
||||
threading::Value** vals) override;
|
||||
bool DoSetBuf(bool enabled) override;
|
||||
bool DoRotate(const char* rotated_path, double open, double close, bool terminating) override;
|
||||
bool DoFlush(double network_time) override;
|
||||
bool DoFinish(double network_time) override;
|
||||
bool DoHeartbeat(double network_time, double current_time) override;
|
||||
bool DoInit(const WriterInfo& info, int num_fields, const threading::Field* const* fields) override;
|
||||
bool DoWrite(int num_fields, const threading::Field* const* fields, threading::Value** vals) override;
|
||||
bool DoSetBuf(bool enabled) override;
|
||||
bool DoRotate(const char* rotated_path, double open, double close, bool terminating) override;
|
||||
bool DoFlush(double network_time) override;
|
||||
bool DoFinish(double network_time) override;
|
||||
bool DoHeartbeat(double network_time, double current_time) override;
|
||||
|
||||
private:
|
||||
friend class plugin::detail::Zeek_AsciiWriter::Plugin;
|
||||
friend class plugin::detail::Zeek_AsciiWriter::Plugin;
|
||||
|
||||
static void RotateLeftoverLogs();
|
||||
static void RotateLeftoverLogs();
|
||||
|
||||
bool IsSpecial(const std::string& path) { return path.find("/dev/") == 0; }
|
||||
bool WriteHeader(const std::string& path);
|
||||
bool WriteHeaderField(const std::string& key, const std::string& value);
|
||||
void CloseFile(double t);
|
||||
std::string Timestamp(double t); // Uses current time if t is zero.
|
||||
void InitConfigOptions();
|
||||
bool InitFilterOptions();
|
||||
bool InitFormatter();
|
||||
bool InternalWrite(int fd, const char* data, int len);
|
||||
bool InternalClose(int fd);
|
||||
bool IsSpecial(const std::string& path) { return path.find("/dev/") == 0; }
|
||||
bool WriteHeader(const std::string& path);
|
||||
bool WriteHeaderField(const std::string& key, const std::string& value);
|
||||
void CloseFile(double t);
|
||||
std::string Timestamp(double t); // Uses current time if t is zero.
|
||||
void InitConfigOptions();
|
||||
bool InitFilterOptions();
|
||||
bool InitFormatter();
|
||||
bool InternalWrite(int fd, const char* data, int len);
|
||||
bool InternalClose(int fd);
|
||||
|
||||
int fd;
|
||||
gzFile gzfile;
|
||||
std::string fname;
|
||||
ODesc desc;
|
||||
bool ascii_done;
|
||||
int fd;
|
||||
gzFile gzfile;
|
||||
std::string fname;
|
||||
ODesc desc;
|
||||
bool ascii_done;
|
||||
|
||||
// Options set from the script-level.
|
||||
bool output_to_stdout;
|
||||
bool include_meta;
|
||||
bool tsv;
|
||||
// Options set from the script-level.
|
||||
bool output_to_stdout;
|
||||
bool include_meta;
|
||||
bool tsv;
|
||||
|
||||
std::string separator;
|
||||
std::string set_separator;
|
||||
std::string empty_field;
|
||||
std::string unset_field;
|
||||
std::string meta_prefix;
|
||||
std::string separator;
|
||||
std::string set_separator;
|
||||
std::string empty_field;
|
||||
std::string unset_field;
|
||||
std::string meta_prefix;
|
||||
|
||||
int gzip_level; // level > 0 enables gzip compression
|
||||
std::string gzip_file_extension;
|
||||
bool use_json;
|
||||
bool enable_utf_8;
|
||||
std::string json_timestamps;
|
||||
bool json_include_unset_fields;
|
||||
std::string logdir;
|
||||
int gzip_level; // level > 0 enables gzip compression
|
||||
std::string gzip_file_extension;
|
||||
bool use_json;
|
||||
bool enable_utf_8;
|
||||
std::string json_timestamps;
|
||||
bool json_include_unset_fields;
|
||||
std::string logdir;
|
||||
|
||||
threading::Formatter* formatter;
|
||||
bool init_options;
|
||||
};
|
||||
threading::Formatter* formatter;
|
||||
bool init_options;
|
||||
};
|
||||
|
||||
} // namespace zeek::logging::writer::detail
|
||||
} // namespace zeek::logging::writer::detail
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue