- Updated bundled
libfmt
to11.1.2
- Suppress
-Wredundant-decls
warning in GCC builds. - Remove
-Wno-gnu-zero-variadic-macro-arguments
for GCC in CMake. - Unified
JsonFileSink.h
andJsonConsoleSink.h
into a single header,JsonSink.h
, with both classes now sharing a common implementation - Users can now inherit from
JsonFileSink
orJsonConsoleSink
and override thegenerate_json_message(...)
function to implement their own custom JSON log formats - Removed
JsonFileSinkConfig
. Please rename it toFileSinkConfig
, which retains the same API and is fully compatible. - Added
RotatingJsonFileSink
. Functions likeRotatingFileSink
, but specifically designed for rotating JSON log files. (#637) - Simplified
ConsoleSink
by applying ANSI colour codes universally across all platforms, including Windows. The previous Windows-specific implementation has been removed. Note thatquill::ConsoleColours
has been replaced withquill::ConsoleSink::Colours
, andquill::ConsoleColours::ColourMode
has been renamed toquill::ConsoleSink::ColourMode
. - Changed class member visibility in
FileSink
,JsonSink
, andRotatingSink
from private to protected, enabling easier customization through inheritance for user-defined implementations. - Added a new
sink_min_flush_interval
option inBackendOptions
, which specifies the minimum time interval (in milliseconds) before the backend thread flushes the output buffers callingflush_sink()
for all sinks, with a default value of 200ms; The backend thread ensures sinks aren't flushed more frequently than this interval, while explicit calls tologger->flush_log()
trigger an immediate flush, and flushing may occur less frequently if the backend thread is busy, with this setting applying globally to all sinks. Setting this value to 0 disables the feature. (#641) - Added a
StopWatch
utility for easy logging of elapsed time. It can log the time elapsed since construction in various formats. You can use eitherquill::StopWatchTsc
for high-resolution TSC-based timing orquill::StopWatchChrono
for standard std::chrono-based timing. (#640)
For example:
#include "quill/StopWatch.h"
quill::StopWatchTsc swt;
std::this_thread::sleep_for(std::chrono::seconds(1));
LOG_INFO(logger, "After 1s, elapsed: {:.6}s", swt); // => After 1s, elapsed: 1.00849s
std::this_thread::sleep_for(std::chrono::milliseconds(500));
LOG_INFO(logger, "After 500ms, elapsed: {}s", swt); // => After 500ms, elapsed: 1.521880274s
LOG_INFO(logger, "elapsed: {}", swt.elapsed_as<std::chrono::nanoseconds>()); // => elapsed: 1521807324ns