quill
BackendOptions.h
1 
7 #pragma once
8 
9 #include "quill/core/Attributes.h"
10 
11 #include <array>
12 #include <chrono>
13 #include <cstdint>
14 #include <cstdio>
15 #include <functional>
16 #include <limits>
17 #include <string>
18 
19 #if defined(__MINGW32__)
20  #include <iostream>
21 #endif
22 
23 QUILL_BEGIN_NAMESPACE
24 
31 {
36  std::string thread_name = "QuillBackend";
37 
44  bool enable_yield_when_idle = false;
45 
49  std::chrono::nanoseconds sleep_duration = std::chrono::nanoseconds{500};
50 
59 
76 
92  size_t transit_events_hard_limit = 32'768;
93 
124  std::chrono::microseconds log_timestamp_ordering_grace_period{1};
125 
137  bool wait_for_queues_to_empty_before_exit = true;
138 
146  uint16_t cpu_affinity = (std::numeric_limits<uint16_t>::max)();
147 
162  std::function<void(std::string const&)> error_notifier = [](std::string const& error_message)
163  {
164 #if !defined(__MINGW32__)
165  std::fprintf(stderr, "%s\n", error_message.data());
166 #else
167  // fprintf crashes on mingw gcc 13 for unknown reason
168  std::cerr << error_message.data() << "\n";
169 #endif
170  };
171 
185  std::chrono::milliseconds rdtsc_resync_interval = std::chrono::milliseconds{500};
186 
202  std::chrono::milliseconds sink_min_flush_interval = std::chrono::milliseconds{200};
203 
217  std::function<bool(char c)> check_printable_char = [](char c)
218  { return (c >= ' ' && c <= '~') || (c == '\n'); };
219 
225  std::array<std::string, 11> log_level_descriptions = {
226  "TRACE_L3", "TRACE_L2", "TRACE_L1", "DEBUG", "INFO", "NOTICE",
227  "WARNING", "ERROR", "CRITICAL", "BACKTRACE", "NONE"};
228 
235  std::array<std::string, 11> log_level_short_codes = {"T3", "T2", "T1", "D", "I", "N",
236  "W", "E", "C", "BT", "_"};
237 
258  bool check_backend_singleton_instance = true;
259 };
260 
261 QUILL_END_NAMESPACE
bool enable_yield_when_idle
The backend employs "busy-waiting" by spinning around each frontend thread&#39;s queue.
Definition: BackendOptions.h:44
uint32_t transit_event_buffer_initial_capacity
The backend pops all log messages from the frontend queues and buffers them in a local ring buffer qu...
Definition: BackendOptions.h:58
std::chrono::nanoseconds sleep_duration
Specifies the duration the backend sleeps if there is no remaining work to process in the queues...
Definition: BackendOptions.h:49
size_t transit_events_hard_limit
The backend gives priority to reading messages from the frontend queues and temporarily buffers them...
Definition: BackendOptions.h:92
size_t transit_events_soft_limit
The backend gives priority to reading messages from the frontend queues of all the hot threads and te...
Definition: BackendOptions.h:75
std::string thread_name
The name assigned to the backend, visible during thread naming queries (e.g., pthread_getname_np) or ...
Definition: BackendOptions.h:36
Configuration options for the backend.
Definition: BackendOptions.h:30