Releases: odygrd/quill
v2.3.3
Fixes
- Previously when multiple threads were loggin, Quill backend logging thread would first try reading the log messages of
one thread until the queue was completely empty before reading the log messages of the next thread.
When one of the threads was logging a lot, it could result in only displaying the log of that thread, hiding the
logs of the other threads. This has now been fixed and all log messages from all threads are read fairly.
v2.3.2
v2.3.1
v2.3.0
Improvements
-
Cache the available bytes for reading in the logging queue. This is meant to offer some minor performance
improvement to the backend logging thread. #185 -
Fixed static code analysis and clang '-Wdocumentation' warnings.
-
The
Handler.h
API has changed in this version to support structured logs. If you have implemented your own custom
Handler
you will have to change it to follow the new API. -
This version adds support for writing structured logs. Structured logs provide easier search through events.
Structured logging is automatically enabled when named arguments are provided to the format string. Structured logs
are only supported by the newquill::JsonFileHandler
handler. The already existingFileHandler
and
ConsoleHandler
are compatible with named arguments, but they will ignore them and output the log in its
original format, as defined by the pattern formatter.
Structured logs are not supported for wide characters at the moment.
See example_json_structured_log.cpp
For example :
quill::start();
quill::Handler* json_handler =
quill::create_handler<quill::JsonFileHandler>("json_output.log", "w");
// create another logger tha logs e.g. to stdout and to the json file at the same time
quill::Logger* logger = quill::create_logger("dual_logger", {quill::stdout_handler(), json_handler});
for (int i = 2; i < 4; ++i)
{
LOG_INFO(logger, "{method} to {endpoint} took {elapsed} ms", "POST", "http://", 10 * i);
}
- Will write to stdout (stdout_handler) :
23:37:19.850432433 [11811] example_json_structured_log.cpp:39 LOG_INFO dual_logger - POST to http:// took 20 ms
23:37:19.850440154 [11811] example_json_structured_log.cpp:39 LOG_INFO dual_logger - POST to http:// took 30 ms
- Will produce a JSON file (json_handler) :
{ "timestamp": "23:37:19.850432433", "file": "example_json_structured_log.cpp", "line": "39", "thread_id": "11811", "logger": "dual_logger", "level": "Info", "message": "{method} to {endpoint} took {elapsed} ms", "method": "POST", "endpoint": "http://", "elapsed": "20" }
{ "timestamp": "23:37:19.850440154", "file": "example_json_structured_log.cpp", "line": "39", "thread_id": "11811", "logger": "dual_logger", "level": "Info", "message": "{method} to {endpoint} took {elapsed} ms", "method": "POST", "endpoint": "http://", "elapsed": "30" }
v2.2.0
v2.2.0
Improvements
- Previously storing the default root logger by calling
quill::get_logger()
followed byquill::configure(cfg)
would invalidate the pointer to the default root logger returned by the former function. This has now been fixed and
the obtainedLogger*
pointer is still valid. - Disable
fmt::streamed()
. (#189) - Update bundled fmt to 9.1.0
logger->should_log(level)
is removed. A compile time check was added tologger->should_log<level>()
. (#187)
v2.1.0
This version includes breaking changes to the API. Those changes are related to how quill is configured, before calling quill::start()
to start the backend thread.
Check the updated examples.
Config.h - contains runtime configuration options
TweakMe.h - contains compile time configuration
For example quill::set_default_logger_handler(...)
has been removed. To set a default filehandler :
// create a handler
quill::Handler* file_handler = quill::file_handler("test.log", "w");
file_handler->set_pattern(
"%(ascii_time) [%(thread)] %(fileline:<28) %(level_name) %(logger_name:<12) - %(message)",
"%Y-%m-%d %H:%M:%S.%Qms", quill::Timezone::GmtTime);
// set the handler as the default handler for any newly created logger in the config
quill::Config cfg;
cfg.default_handlers.emplace_back(file_handler);
// configure must always be called prior to `start()`
quill::configure(cfg);
quill::start();
- Removed some API functions from
Quill.h
that were previously used for configuration. Instead,quill::Config
object has to be created. For examplequill::config::set_backend_thread_cpu_affinity(1);
has been removed and instead the following code is needed :
quill::Config cfg;
cfg.backend_thread_cpu_affinity = 1;
quill::configure(cfg);
QUILL_CHRONO_CLOCK
has been moved fromTweakMe.h
toConfig.h
. It is now possible to switch betweenrdtsc
andsystem
clocks without re-compiling.
See example_trivial_system_clock.cppQUILL_RDTSC_RESYNC_INTERVAL
has been moved fromTweakMe.h
toConfig.h
.- It is now possible to log user timestamps rather than the system's. This feature is useful for time simulations.
See example_custom_clock.cpp
and example_custom_clock_advanced.cpp - Previously the logger names were limited to a maximum of 22 characters. This limitation has been removed.
- Added support for gcc 7.5.0. (#178)
- Updated bundled fmt to 9.0.0
v2.0.2
v2.0.1
v2.0.0
From version v2
and onwards only c++17 is supported.
This version is a major refactor.
Fixes
- RotatingFileHandler will now correctly rotate the files when append mode is used (#123)
Improvements
- Reduced and simplified codebase.
- Improved backend worker thread performance.
QUILL_DUAL_QUEUE_MODE
has been removed. A single queue now handles every case.QUILL_STRING
has been removed. That macro is no longer required when passing a format string to the
PatternFormatter.
Differences
v1.7
compiles with c++14,v2
only compiles for c++17.v1.7
on Windows supports wide character logging,v2
has limited wide character support such as loggingwchar_t
,std::wstring
,std::wstring_view
. For example, loggingstd::vector<std::wstring>
is not supported.v1.7
on Windows requires the filepath used for the handlers as a wide strings,v2
supports only filenames as narrow strings.