Releases: odygrd/quill
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});
v6.1.2
v6.1.1
v6.1.0
- Fix various compiler warnings
- Minor serialisation improvements in
Array.h
andChrono.h
- Introduced
Backend::acquire_manual_backend_worker()
as an advanced feature, enabling users to manage the backend worker on a custom thread. This feature is intended for advanced use cases where greater control over threading is required. (#519) - Add new
CsvWriter
utility class for asynchronous CSV file writing. For example:#include "quill/Backend.h" #include "quill/core/FrontendOptions.h" #include "quill/CsvWriter.h" struct OrderCsvSchema { static constexpr char const* header = "order_id,symbol,quantity,price,side"; static constexpr char const* format = "{},{},{},{:.2f},{}"; }; int main() { quill::BackendOptions backend_options; quill::Backend::start(backend_options); quill::CsvWriter<OrderCsvSchema, quill::FrontendOptions> csv_writer {"orders.csv"}; csv_writer.append_row(13212123, "AAPL", 100, 210.32321, "BUY"); csv_writer.append_row(132121123, "META", 300, 478.32321, "SELL"); csv_writer.append_row(13212123, "AAPL", 120, 210.42321, "BUY"); }
v6.0.0
-
Added a Cheat Sheet to help users get the most out of the logging library
-
Removed
ArgSizeCalculator<>
,Encoder<>
, andDecoder<>
classes. These have been consolidated into a singleCodec
class. Users who wish to pass user-defined objects should now specialize this singleCodec
class instead of managing three separate classes. For guidance, please refer to the updated advanced example -
Added
TriviallyCopyableCodec.h
to facilitate serialization for trivially copyable user-defined types. For examplestruct TCStruct { int a; double b; char c[12]; friend std::ostream& operator<<(std::ostream& os, TCStruct const& arg) { os << "a: " << arg.a << ", b: " << arg.b << ", c: " << arg.c; return os; } }; template <> struct fmtquill::formatter<TCStruct> : fmtquill::ostream_formatter { }; template <> struct quill::Codec<TCStruct> : quill::TriviallyCopyableTypeCodec<TCStruct> { }; int main() { // init code ... TCStruct tc; tc.a = 123; tc.b = 321; tc.c[0] = '\0'; LOG_INFO(logger, "{}", tc); }
-
Added support for passing arithmetic or enum c style arrays when
std/Array.h
is included. For example#include "quill/std/Array.h" int a[6] = {123, 456}; LOG_INFO(logger, "a {}", a);
-
Added support for
void const*
formatting. For exampleint a = 123; int* b = &a; LOG_INFO(logger, "{}", fmt::ptr(b));
-
Added support for formatting
std::chrono::time_point
andstd::chrono::duration
with the inclusion
ofquill/std/Chrono.h
#include "quill/std/Chrono.h" std::chrono::system_clock::time_point now = std::chrono::system_clock::now(); LOG_INFO(logger, "time is {}", now);
-
Removed unused method from
ConsoleSink
v5.1.0
- Fix unit tests on FreeBSD (#496)
- Resolved unused variable warning on MSVC.
- Updated CMake to avoid adding
-fno-exceptions
to the entire target whenQUILL_NO_EXCEPTIONS=ON
(#499) - Fix an issue where timestamps were incorrectly calculated when using
quill::Timezone::LocalTime
. This bug affected timezones that did not have an exact hour difference from UTC, leading to incorrect timestamp calculations. (#498) - The newline character
\n
is now considered printable by default and will no longer be sanitized. Users can now include new lines in their logs directly. In versions4.4.1
and earlier,\n
was not sanitized, and this behavior is restored in this update, eliminating the need for a customcheck_printable_char
function inBackendOptions
. - On Windows, when colors are enabled in
ConsoleSink
,GetConsoleScreenBufferInfo
may fail in the debug console. Previously, this would result in an error being displayed but no logs being written. This issue is now resolved: the error is reported once, and logs will be written to the console without colors. - Improved performance of
StringFromTime
andTimestampFormatter
used by the backend worker thread. - Replaced
std::mutex
with a spinlock, resulting in minor performance improvement for backend worker. This change also avoids including<mutex>
in the frontend, particularly when following the recommended_usage
example - Update bundled
libfmt
to11.0.2
v5.0.0
-
Fix build failure on Windows Arm64 (#485)
-
Previously, wide string support was included in
Codec.h
. Wide string functionality has now been moved to a separate header file,WideStrings.h
. On Windows, logging wide strings now requires the inclusion ofquill/std/WideStrings.h
. -
Added
QUILL_IMMEDIATE_FLUSH
preprocessor variable. This variable can be defined before includingLogMacros.h
or passed as a compiler flag. WhenQUILL_IMMEDIATE_FLUSH
is defined, the library will flush the log on each log statement. This causes the caller thread to wait for the log to be processed and written to the log file by the backend thread before continuing, significantly impacting performance. This feature is useful for debugging the application when synchronized logs are required. (#488) -
Introduced
log_level_descriptions
andlog_level_short_codes
inBackendOptions
to allow customization ofLogLevel
descriptions and short codes, replacing previously hardcoded values. This enhancement enables users to define their own descriptions and short codes for each log level. For instance, instead of displayingLOG_WARNING
, it can now be configured to showLOG_WARN
. (#489)quill::BackendOptions backend_options; backend_options.log_level_descriptions[static_cast<uint32_t>(quill::LogLevel::Warning)] = "WARN"; quill::Backend::start(backend_options);
-
Introduced
LOGV_LEVEL
,LOGV_LEVEL_LIMIT
, andLOGV_LEVEL_WITH_TAGS
macros. These new macros simplify logging by automatically printing variable names and values without explicitly specifying each variable name or using{}
placeholders in the format string. Each macro can handle up to 26 arguments. The format string is concatenated at compile time, there is no runtime overhead for using these macros. For example:int a = 123; double b = 3.17; LOGV_INFO(logger, "A message with two variables", a, b)
outputs
A message with two variables [a: 123, b: 3.17]
-
Introduced
LOGJ_LEVEL
,LOGJ_LEVEL_LIMIT
, andLOGJ_LEVEL_WITH_TAGS
macros. These new macros simplify JSON logging by automatically embedding the name of each passed variable as a named argument in the format string. Each macro can handle up to 26 arguments. The format string is concatenated at compile time, there is no runtime overhead for using these macros. For example:int var_a = 123; std::string var_b = "test"; LOGJ_INFO(logger, "A json message", var_a, var_b);
outputs
{"log_level":"INFO","message":"A json message {var_a}, {var_b}","var_a":"123","var_b":"test"}
-
Enhanced the
filter
function to also receive the formattedlog_message
alongside the log_statement, enabling the comparison and filtering oflog_message
while disregarding elements like timestamps from the fulllog_statement
. (#493) -
Renamed
log_message
tolog_statement
andshould_log_message
toshould_log_statement
inLogger
-
Replaced
%(log_level_id)
with%(log_level_short_code)
in thePatternFormatter
. -
Fix a
CMakeLists
error for oldCMake
versions prior to3.19
. (#491)
v4.5.0
-
The backend now automatically sanitizes non-printable characters in log messages by converting them to their hexadecimal representation. This feature ensures logs contain only safe, readable characters. You can customize or disable this feature through the
BackendOptions
by modifying thecheck_printable_char
callback.std::function<bool(char c)> check_printable_char = [](char c) { return c >= ' ' && c <= '~'; };
-
Added
StringRef
, a utility class for passing string arguments by reference without copying. Suitable for string literals or immutable strings with a guaranteed persistent lifetime. For example#include "quill/StringRef.h" static constexpr std::string_view sv {"string_view"}; LOG_INFO(logger, "{} {}", quill::utility::StringRef{sv}, quill::utility::StringRef{"string_literal"});
-
Renamed
write_log_message
towrite_log
inSink
. The formattedlog_message
andprocess_id
are now also provided. This enhancement supports use cases where the formattedlog_statement
passed to theSink
can be ignored and overwritten with a custom format, allowing a singleLogger
to output different formats to variousSinks
(#476) -
Fixed a bug in JSON logging where previously cached named arguments could erroneously append to subsequent log statements. (#482)