v3.3.0
-
Added a
quill::get_handler(handler_name)
function that allows easy lookup of an existingHandler
by name. This
function proves helpful when you want to retrieve a handler and pass it to a new logger. -
Fix build failure of Intel Compiler Classic. (#332)
-
Introduced
QUILL_BLOCKING_QUEUE_RETRY_INTERVAL_NS
option for user-configurable retry interval in the blocking queue.
Default value is 800 nanoseconds. (#330) -
Improved backend thread handling. Now verifies that all producer SPSC queues are empty before entering
sleep
. -
Fixed a race condition and potential crash in
quill::remove_logger(Logger*)
when called without priorquill::flush()
. -
Added protection to prevent removal of the root logger with
quill::remove_logger(Logger*)
. -
Improved exception handling on the backend thread when calling
fmt::format()
.While compile-time checks ensure that the format string and arguments match, runtime errors can still occur.
Previously, such exceptions would affect and drop subsequent log records. Now, exceptions are caught and logged
in the log file and reported via the backend thread notification handler (default iscerr
).For example, if a dynamic precision is used (
LOG_INFO(logger, "Support for floats {:.{}f}", 1.23456, 3.321312)
),
the log file will show the following error message:LOG_INFO root [format: "Support for floats {:.{}f}", error: "precision is not integer"]
Additionally, an error message will be printed to
cerr
Quill ERROR: [format: "Support for floats {:.{}f}", error: "precision is not integer"]
-
Fixed a bug in timestamp formatting that occasionally displayed an hour component of 0 as
24. (#329) -
Added support for specifying a runtime log level, allowing dynamic log level configuration at runtime.
The new runtime log level feature provides flexibility when needed, with a minor overhead cost.
It is recommended to continue using the existing static log level macros for optimal
performance. (#321)For example
std::array<quill::LogLevel, 4> const runtime_log_levels = {quill::LogLevel::Debug, quill::LogLevel::Info, quill::LogLevel::Warning, quill::LogLevel::Error}; for (auto const& log_level : runtime_log_levels) { LOG_DYNAMIC(logger, log_level, "Runtime {} {}", "log", "level"); }
-
Added support for printf-style formatting with
_CFORMAT
macros. These macros use theprintf
format string syntax,
simplifying the migration of legacy codebases usingprintf
statements.For example
std::array<uint32_t, 4> arr = {1, 2, 3, 4}; LOG_INFO(logger, "This is a log info example using fmt format {}", arr); LOG_INFO_CFORMAT(logger, "printf style %s supported %d %f", "also", 5, 2.32);
-
Added a
metadata()
member function to theTransitEvent
class. It provides access to theMetadata
object
associated with the log record, simplifying syntax for retrieving log record metadata in custom Handlers.For example
void CustomHandler::write(fmt_buffer_t const& formatted_log_message, quill::TransitEvent const& log_event) { MacroMetadata const macro_metadata = log_event.metadata(); }
-
Simplified file handler configuration. Now, instead of passing multiple arguments to the constructor,
you only need to provide a singleFileHandlerConfig
object. This change makes creating file handlers objects
much easier and more flexible.For example
quill::FileHandlerConfig file_handler_cfg; file_handler_cfg.set_open_mode('w'); file_handler_cfg.set_append_to_filename(quill::FilenameAppend::StartDateTime); std::shared_ptr<quill::Handler> file_handler = quill::file_handler("application.log", file_handler_cfg); quill::Logger* logger_foo = quill::create_logger("my_logger", std::move(file_handler)); LOG_INFO(my_logger, "Hello from {}", "application");
-
Combined the functionalities of
RotatingFileHandler
(rotating based on file size) andTimeRotatingFileHandler
(rotating on a time interval) into a single, more versatileRotatingFileHandler
. Users can now conveniently rotate
logs based on both file size and time intervals simultaneously. The updatedRotatingFileHandler
offers a variety of
customization options for improved flexibility. For more information on available configurations,
refer to theRotatingFileHandlerConfig
documentation.For example
// Create a rotating file handler which rotates daily at 18:30 or when the file size reaches 2GB std::shared_ptr<quill::Handler> file_handler = quill::rotating_file_handler(filename, []() { quill::RotatingFileHandlerConfig cfg; cfg.set_rotation_time_daily("18:30"); cfg.set_rotation_max_file_size(2'000'000'000); return cfg; }()); // Create a logger using this handler quill::Logger* logger_bar = quill::create_logger("daily_logger", std::move(file_handler));
-
Improved compatibility with older versions of external
libfmt
. Quill now compiles for all versions
oflibfmt >= 8.0.0
.