Repository navigation
v9.0.0
API Changes
- Replaced the
bool huge_pages_enabledflag inFrontendOptionswithquill::HugePagesPolicy huge_pages_policyenum, allowing huge page allocation to be attempted with a fallback to normal pages if unavailable. If you are using a customFrontendOptionstype, you will need to update it to use the new flag. (#707) - Previously,
QueueType::UnboundedDroppingandQueueType::UnboundedBlockingcould grow up to 2 GB in size. This limit is now configurable viaFrontendOptions::unbounded_queue_max_capacity, which defaults to 2 GB. QueueType::UnboundedUnlimitedhas been removed, as the same behavior can now be achieved by settingFrontendOptions::unbounded_queue_max_capacityto the maximum value.- The
ConsoleSinkconstructor now optionally accepts aConsoleSinkConfig, similar to other sinks. If noConsoleSinkConfigis provided, a default one is used, logging tostdoutwithColourMode::Automatic. For example:Frontend::create_or_get_sink<ConsoleSink>("console_sink", []() { ConsoleSinkConfig config; config.set_colour_mode(ConsoleSinkConfig::ColourMode::Never); config.set_stream("stderr"); return config; }());
New Features
-
The default log level for each
Loggercan now be configured using the environment variableQUILL_LOG_LEVEL. Supported values:"tracel3","tracel2","tracel1","debug","info","notice","warning","error","critical","none". When set, the logger is initialized with the corresponding log level. Iflogger->set_log_level(level)is explicitly called in code, it will override the log level set via the environment variable. -
Added the
LOG_RUNTIME_METADATA(logger, log_level, file, line_number, function, fmt, ...)macro. This enables passing runtime metadata (such as file, line number, and function) along with a log message, providing greater flexibility when forwarding logs from other logging libraries. (#696)LOG_RUNTIME_METADATA(logger, quill::LogLevel::Info, "main.cpp", 20, "foo()", "Hello number {}", 8);
-
Added a runtime check to detect duplicate backend worker threads caused by inconsistent linkage (e.g., mixing static and shared libraries). If needed, this check can be disabled using the
check_backend_singleton_instanceflag inBackendOptions. (#687) -
Added the
QUILL_DISABLE_FUNCTION_NAMEpreprocessor flag and CMake option. This allows disabling__FUNCTION__inLOG_*macros when%(caller_function)is not used inPatternFormatter, eliminating Clang-Tidy warnings when logging inside lambdas. -
It is now possible to override a logger's
PatternFormatteron a per-sink basis. This allows the same logger to output different formats for different sinks. Previously, achieving this required creating a custom sink type, but this functionality is now built-in. See the example: sink_formatter_override. -
Added
Frontend::remove_logger_blocking(...), which blocks the caller thread until the specified logger is fully removed. -
Added
Frontend::shrink_thread_local_queue(capacity)andFrontend::get_thread_local_queue_capacity(). These functions allow dynamic management of thread-local SPSC queues when using an unbounded queue configuration. They enable on-demand shrinking of a queue that has grown due to bursty logging, helping to reduce memory usage, although in typical scenarios they won't be required. -
Added the
SyslogSink, which logs messages to the system's syslog.auto sink = quill::Frontend::create_or_get_sink<quill::SyslogSink>( "app", []() { quill::SyslogSinkConfig config; config.set_identifier("app"); return config; }());
-
Added the
SystemdSink, which logs messages to systemd.auto sink = quill::Frontend::create_or_get_sink<quill::SystemdSink>( "app", []() { quill::SystemdSinkConfig config; config.set_identifier("app"); return config; }());
-
Added the
AndroidSink, which integrates with Android's logging system.auto sink = quill::Frontend::create_or_get_sink<quill::AndroidSink>( "s1", []() { quill::AndroidSinkConfig config; config.set_tag("app"); config.set_format_message(true); return config; }());
Improvements
-
Updated bundled
libfmtto11.1.4. -
When
add_metadata_to_multi_line_logsin thePatternFormatterwas set to false, fixed a bug where the last character of the log message was dropped and added protection for empty messages. -
Updated
LOG_EVERY_Nmacros to log on the first occurrence (0th call) instead of waiting until the Nth call. -
Added a
nullptrcheck forchar*andconst char*during encoding, ensuring the library handlesnullptrvalues gracefully (#735) -
The
CsvWritercould previously be used withRotatingFileSinkvia the constructor that acceptedstd::shared_ptr<Sink>, but rotated files did not include the CSV header. This has now been improved—when using the new constructor that acceptsquill::RotatingFileSinkConfig, the CSV header is written at the start of each new rotated file. (#700)quill::RotatingFileSinkConfig sink_config; sink_config.set_open_mode('w'); sink_config.set_filename_append_option(FilenameAppendOption::None); sink_config.set_rotation_max_file_size(512); sink_config.set_rotation_naming_scheme(RotatingFileSinkConfig::RotationNamingScheme::Index); quill::CsvWriter<OrderCsvSchema, quill::FrontendOptions> csv_writer{"orders.csv", sink_config}; for (size_t i = 0; i < 40; ++i) { csv_writer.append_row(132121122 + i, "AAPL", i, 100.1, "BUY"); }
-
When using
CsvWriterwithopen_mode == 'a', the header will no longer be rewritten if the file already exists. -
On Linux, setting a long backend thread name now truncates it instead of failing. (#691)
-
Fixed BSD builds. (#688)
-
Added adaptive termination for stable measurements in
rdtsccalibration during init -
Fixed
QUILL_ATTRIBUTE_HOTandQUILL_ATTRIBUTE_COLDclang detection -
CMake improvements: switched to range syntax for minimum required version and bumped minimum required CMake version to
3.12. (#686) -
Correct the installation location of pkg-config files. They are now properly placed in
/usr/local/lib. (#715) -
Removed deprecated
TriviallyCopyableTypeCodec