Releases: odygrd/quill
v7.5.0
-
The
LOG_LEVEL_LIMIT
time-based rate-limiting macros now log the count of how many times a message would be logged when throttled. For example, a log message may appear asA log message with number 123 (21x)
to indicate that the message would have been logged 21 times. (#616) -
New macros
LOG_LEVEL_LIMIT_EVERY_N
have been added, allowing for count-based rate limiting and giving developers greater control over logging frequency. (#616) -
In previous versions, logging on Windows automatically included
windows.h
in all components. The frontend will no longer includewindows.h
. By following the recommended usage example provided here as guidance, you can create a wrapper library around Quill for the backend, allowing you to log on Windows without includingwindows.h
in the frontend or main program. (#618) -
Renamed
PACKED
used inlibfmt
toQUILLPACKED
to avoid naming collisions. (#620) -
The
set_thread_name
function has been fixed to provide accurate error reporting, ensuring that the correct error message is displayed in the event of a failure.
v7.4.0
-
Fixed a build issue when compiling with
-fno-rtti
. This ensures compatibility with projects that disableRTTI
. (#604) -
Fixed an incorrectly triggered assertion in debug builds when
BackendOptions::log_timestamp_ordering_grace_period
is set to 0. (#605) -
Fixed a compile-time error in
CsvWriter
that occurred when passing a customFrontendOptions
type as a template parameter. (#609) -
Added accessors to
Logger
for sinks, user clock source, clock source type, and pattern formatter options that can be used to create anotherLogger
with similar configuration. -
Added
ConsoleColours::ColourMode
toConsoleSink
, allowing colors to be explicitly forced or conditionally enabled based on the environment. Previously, colors were only conditionally enabled. (#611).For example:
quill::Frontend::create_or_get_sink<quill::ConsoleSink>( "sink_id_1", quill::ConsoleColours::ColourMode::Automatic);
v7.3.0
- Added the option to explicitly specify the
Logger
used by the built-inSignalHandler
for logging errors during application crashes. (#590) - Prevented error logs from the
SignalHandler
from being output to CSV files when aCsvWriter
is in use. (#588) - Introduced
SignalHandlerOptions
to simplify and unify the API.Backend::start_with_signal_handler
is now deprecated, replaced by a newBackend::start
overload that acceptsSignalHandlerOptions
for enabling signal handling. - Added a new
create_or_get_logger
overload that accepts astd::vector<std::shared_ptr<Sink>>
, improving flexibility by allowing a variable number of sinks to be passed at runtime when creating a logger. - Added a new overload to
create_or_get_logger
to create a logger that inherits configuration options from a specified logger. (#596) - Implemented a workaround to resolve false positive warnings from
clang-tidy
on Windows.
v7.2.2
v7.2.1
v7.2.0
Bug Fixes:
- Fixed compile error in
BackendTscClock
(#577) - Added a missing header include in
TriviallyCopyableCodec.h
. (#560) - Fixed incorrect log level short codes introduced in v7 after adding the new log level
NOTICE
. Using%(log_level_short_code)
in the pattern formatter could incorrectly mapLOG_ERROR
to"C"
and LOG_WARNING to"E"
. (#564) - Fixed an overflow issue when logging more than
uint32_t::max()
bytes in a single log message. For example, attempting to logstd::string s(std::numeric_limits<uint32_t>::max(), 'a');
would previously cause a crash.
Improvements:
- Optimised dynamic log level handling and size calculation for fundamental types,
std::string
andstd::string_view
on the hot path. - Several enhancements to the backend worker thread, resulting in an overall 10% backend throughput increase. Key optimizations include the simplification of
TransitEventBuffer
, reducing the memory footprint ofTransitEvent
, introducing support for custom buffer sizes in file streams and tuningtransit_events_soft_limit
andtransit_events_hard_limit
default values - Improved readability of queue allocation notification messages. Capacities are now displayed in KiB, e.g.,
20:59:25 Quill INFO: Allocated a new SPSC queue with a capacity of 1024 KB (previously 512 KB) from thread 31158
.
New Features:
- Introduced support for custom buffer sizes in file streams for
FileSink
andRotatingFileSink
. Buffer size is now configurable viaFileSinkConfig::set_write_buffer_size(size_value)
with a default of 64 KB. - Added an optional
fsync
interval to control the minimum time between consecutivefsync
calls, reducing disk wear from frequent fsync operations. This option is only applicable whenfsync
is enabled. (#557) - Implemented support for appending a custom timestamp format to log filenames via
StartCustomTimestampFormat
.
Example usage:This will create a log file namedauto file_sink = quill::Frontend::create_or_get_sink<quill::FileSink>("logfile.log", []() { quill::FileSinkConfig cfg; cfg.set_filename_append_option(quill::FilenameAppendOption::StartCustomTimestampFormat, "%m%d"); return cfg; }());
logfile0919.log
, where0919
represents the month and day. - When using
%(named_args)
in the pattern formatter or logging in JSON format, extra arguments without key names are now included in JSON output with keys corresponding to their positional indexes. This allows additional details to be included in the JSON while keeping the log message clean. For example (#563):This will output:LOG_INFO(hybrid_logger, "Operation {name} completed with code {code}", "Update", 123, "Data synced successfully");
And the corresponding JSON will be:Operation Update completed with code 123
{"timestamp":"1726582319816776867","file_name":"json_file_logging.cpp","line":"71","thread_id":"25462","logger":"hybrid_logger","log_level":"INFO","message":"Operation {name} completed with code {code}","name":"Update","code":"123","_2":"Data synced successfully"}
v7.1.0
- Fixed crash when using
QueueType::BoundedDropping
orQueueType::UnboundedDropping
after a message drops. (#553) - Improved performance of
std::forward_list
decoding. - Corrected reported dropped message count; previously, log flush attempts were incorrectly included.
- Removed leftover files after running some unit tests.
- Stabilized regression tests.
- Suppressed false-positive
-Wstringop-overflow
warnings (e.g., with GCC 13). - Fixed MinGW build and added MinGW builds to GitHub Actions.
v7.0.0
-
Simplified the log tags API. The
Tags
class has been removed. You now pass achar const*
directly to the macros.
Additionally, macros previously namedWITH_TAGS
have been renamed to_TAGS
. For example,LOG_INFO_WITH_TAGS
is
nowLOG_INFO_TAGS
. -
Renamed
backend_cpu_affinity
tocpu_affinity
inBackendOptions
to improve consistency. -
Simplified project structure by removing the extra quill directory and made minor CMake improvements;
include/quill
is now directly in the root. -
Added support for
std::string
with custom allocator. (#524) -
Added a new log level
NOTICE
, for capturing significant events that aren't errors or warnings. It fits betweenINFO
andWARNING
for logging important runtime events that require attention. (#526) -
Enhanced static assert error message for unsupported codecs, providing clearer guidance for STL and user-defined types.
-
Improved frontend performance by caching the
ThreadContext
pointer inLogger
class to avoid repeated function calls. On Linux, this is now further optimised with__thread
for thread-local storage, while other platforms still usethread_local
. -
Minor performance enhancement in the frontend by replacing
std::vector<size_t>
with anInlinedVector<uint32_t, 12>
for caching sizes (e.g. string arguments). -
Fixed order of evaluation for
Codec::pair<T1,T2>::compute_encoded_size()
to prevent side effects observed on MSVC -
Introduced the
add_metadata_to_multi_line_logs
option inPatternFormatter
. This option, now enabled by default, appends metadata such as timestamps and log levels to every line of multiline log entries, ensuring consistent log output. To restore the previous behavior, set this option to false when creating aLogger
usingFrontend::create_or_get_logger(...)
. Note that this option is ignored when logging JSON using named arguments in the format message. (#534) -
JSON
sinks now automatically remove any\n
characters from format messages, ensuring the emission of validJSON
messages even when\n
is present in the format. -
Replaced
static
variables withstatic constexpr
in theConsoleColours
class. -
Fixed compiler errors in a few rarely used macros. Added a comprehensive test for all macros to prevent similar issues in the future.
-
Expanded terminal list for color detection in console applications on Linux
-
Fixed an issue where
char*
andchar[]
types could be incorrectly selected by the Codec template inArray.h
-
The library no longer defines
__STDC_WANT_LIB_EXT1__
, as the bounds-checking functions from the extensions are no longer needed. -
StringFromTime
constructor no longer relies on the system's current time, improving performance in simulations where timestamps differ from system time. (#541) -
The
Frontend::create_or_get_logger(...)
function now accepts aPatternFormatterOptions
parameter, simplifying the API. This is a breaking change. To migrate quickly, wrap the existing formatting parameters in aPatternFormatterOptions
object.Before:
quill::Logger* logger = quill::Frontend::create_or_get_logger("root", std::move(file_sink), "%(time) [%(thread_id)] %(short_source_location:<28) " "LOG_%(log_level:<9) %(logger:<12) %(message)", "%H:%M:%S.%Qns", quill::Timezone::GmtTime);
After:
quill::Logger* logger = quill::Frontend::create_or_get_logger("root", std::move(file_sink), quill::PatternFormatterOptions { "%(time) [%(thread_id)] %(short_source_location:<28) " "LOG_%(log_level:<9) %(logger:<12) %(message)", "%H:%M:%S.%Qns", quill::Timezone::GmtTime});