3 #include "quill/Backend.h" 4 #include "quill/Frontend.h" 5 #include "quill/Logger.h" 6 #include "quill/sinks/FileSink.h" 10 #ifndef FUZZER_LOG_FILENAME 11 #error "FUZZER_LOG_FILENAME must be defined before including FuzzerHelper.h" 16 static constexpr
size_t initial_queue_capacity = 4096;
20 static quill::Logger* g_logger =
nullptr;
21 static bool g_initialized =
false;
23 extern "C" int LLVMFuzzerInitialize(
int* ,
char*** )
28 quill::BackendOptions backend_options;
29 backend_options.transit_event_buffer_initial_capacity = 2;
31 #ifdef FUZZER_USE_BINARY_MODE 33 backend_options.check_printable_char = {};
36 quill::Backend::start(backend_options);
38 #ifdef FUZZER_USE_BINARY_MODE 40 quill::PatternFormatterOptions pattern_options;
41 pattern_options.format_pattern =
"%(message)";
42 pattern_options.add_metadata_to_multi_line_logs =
false;
43 pattern_options.pattern_suffix = quill::PatternFormatterOptions::NO_SUFFIX;
46 auto file_sink = quill::Frontend::create_or_get_sink<quill::FileSink>(
50 quill::FileSinkConfig cfg;
51 #ifdef FUZZER_USE_BINARY_MODE 52 cfg.set_open_mode(
"wb");
54 cfg.set_open_mode(
'w');
56 cfg.set_filename_append_option(quill::FilenameAppendOption::None);
59 quill::FileEventNotifier{});
61 #ifdef FUZZER_USE_BINARY_MODE 62 g_logger = quill::Frontend::create_or_get_logger(
"root", std::move(file_sink), pattern_options);
64 g_logger = quill::Frontend::create_or_get_logger(
"root", std::move(file_sink));
67 g_logger->set_log_level(quill::LogLevel::TraceL3);
71 #ifndef FUZZER_IMMEDIATE_FLUSH_LIMIT 72 g_logger->set_immediate_flush(2048);
74 g_logger->set_immediate_flush(FUZZER_IMMEDIATE_FLUSH_LIMIT);
This example demonstrates how to change the type of the Single Producer Single Consumer (SPSC) queue ...
Definition: bounded_dropping_queue_frontend.cpp:24