Releases: odygrd/quill
v3.3.1
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
.
v2.0.3
v3.2.0
- Addition of
std::is_trivially_copyable<T>
to default copy loggable types. (#318) - By default, the static library now builds with
-fPIC
to generate position-independent code.
To disable this feature, you can use the CMake optionQUILL_DISABLE_POSITION_INDEPENDENT_CODE
. - The
LOG_<LEVEL>_LIMIT
macros now support usingstd::chrono
duration types for specifying the log interval.
Instead of providing a raw number, you can use:
LOG_INFO_LIMIT(std::chrono::milliseconds {100} , quill::get_logger(), "log message");
v3.1.0
- It is now possible to set a minimum logging interval for specific logs. For example:
for (uint64_t i = 0; i < 10; ++i)
{
LOG_INFO_LIMIT(2000, default_logger, "log in a loop with limit 1 message every 2000 micros for i {}", i);
std::this_thread::sleep_for(std::chrono::microseconds{1000});
}
-
quill::utility::to_string()
now usesfmt::to_string()
-
Quill now utilizes a custom namespace (
fmtquill
) for the bundled fmt library. This enables smooth integration with
your own external fmt library, even if it's a different version.
v3.0.2
v3.0.1
v3.0.0
- The previous unbounded queue constantly reallocated memory, risking system memory exhaustion, especially when handling intensive logging from multiple threads. Starting from
v3.0.0
, the default behavior has been improved to limit the queue capacity to 2 GB. When this limit is reached, the queue blocks the hot thread instead of further reallocation. To modify the default behavior, there is no need to recompile thequill
library. Recompile your application with one of the following header-only flags.
# Previous behavior in v2.*.*: Reallocates new queues indefinitely when max capacity is reached
-DCMAKE_CXX_FLAGS:STRING="-DQUILL_USE_UNBOUNDED_NO_MAX_LIMIT_QUEUE"
# Default behavior in v3.*.*: Starts small, reallocates up to 2GB, then hot thread blocks
-DCMAKE_CXX_FLAGS:STRING="-DQUILL_USE_UNBOUNDED_BLOCKING_QUEUE"
# Starts small, reallocates up to 2GB, then hot thread drops log messages
-DCMAKE_CXX_FLAGS:STRING="-DQUILL_USE_UNBOUNDED_DROPPING_QUEUE"
# Fixed queue size, no reallocations, hot thread drops log messages
-DCMAKE_CXX_FLAGS:STRING="-DQUILL_USE_BOUNDED_QUEUE"
# Fixed queue size, no reallocations, hot thread blocks
-DCMAKE_CXX_FLAGS:STRING="-DQUILL_USE_BOUNDED_BLOCKING_QUEUE"
- Added support for huge pages on Linux. Enabling this feature allows bounded or unbounded queues to utilize huge pages,
resulting in optimized memory allocation.
quill::Config cfg;
cfg.enable_huge_pages_hot_path = true;
quill::configure(cfg);
quill::start();
- Added support for logging
std::optional
, which is also now supported inlibfmt
v10.0.0
.
LOG_INFO(default_logger, "some optionals [{}, {}]", std::optional<std::string>{},
std::optional<std::string>{"hello"});
- Introduced a new function
run_loop
in theHandler
base class, which allows users to override and execute periodic tasks. This enhancement provides users with the flexibility to perform various actions at regular intervals, such as batch committing data to a database. - In scenarios where a hot thread is blocked and unable to push messages to the queue in blocking mode, this situation will now be reported through the
backend_thread_notifications_handler
to the standard error streamcerr
.
v2.9.2
v2.9.1
- Removed
CMAKE_INSTALL_RPATH
from cmake. (#284) - Fix compile warning on Apple M1. (#291)
- Update bundled
libfmt
tov10.0.0
- Fix for
CMAKE_MODULE_PATH
(#295) - Fixed a bug in
TimeRotatingFileHandler
whenquill::FilenameAppend::None
is used. (#296) - Fixed
TimeRotatingFileHandler
andRotatingFileHandler
to work when/dev/null
is used as a filename (#297) - Added
NullHandler
that can be used to discard the logs. For example:
int main()
{
quill::start();
std::shared_ptr<quill::Handler> file_handler =
quill::null_handler();
quill::Logger* logger_bar = quill::create_logger("nullhandler", std::move(file_handler));
for (uint32_t i = 0; i < 150; ++i)
{
LOG_INFO(logger_bar, "Hello");
}