Repository navigation
v8.0.0
- Updated bundled
libfmtto11.1.2 - Suppress
-Wredundant-declswarning in GCC builds. - Remove
-Wno-gnu-zero-variadic-macro-argumentsfor GCC in CMake. - Unified
JsonFileSink.handJsonConsoleSink.hinto a single header,JsonSink.h, with both classes now sharing a common implementation - Users can now inherit from
JsonFileSinkorJsonConsoleSinkand 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
ConsoleSinkby applying ANSI colour codes universally across all platforms, including Windows. The previous Windows-specific implementation has been removed. Note thatquill::ConsoleColourshas been replaced withquill::ConsoleSink::Colours, andquill::ConsoleColours::ColourModehas been renamed toquill::ConsoleSink::ColourMode. - Changed class member visibility in
FileSink,JsonSink, andRotatingSinkfrom private to protected, enabling easier customization through inheritance for user-defined implementations. - Added a new
sink_min_flush_intervaloption 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
StopWatchutility for easy logging of elapsed time. It can log the time elapsed since construction in various formats. You can use eitherquill::StopWatchTscfor high-resolution TSC-based timing orquill::StopWatchChronofor 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