Releases: odygrd/quill
v2.9.0
Fixes
- Fixed a bug in TimeRotatingFileHandler. (#287)
Improvements
- Renamed
backend_thread_error_handler
tobackend_thread_notifications_handler
inConfig.h
. Previously this
handler was used only to report errors from the backend worker thread to the user. This callback will also now report
info messages to the user. - Report unbounded spsc queue reallocation via
thebackend_thread_notifications_handler
. (#286) - Report bounded spsc queue dropped messages via the
backend_thread_notifications_handler
.
v2.8.0
Breaking Changes
(see improvements
section for more details)
- If you were previously compiling with
-DQUILL_USE_BOUNDED_QUEUE
orQUILL_X86ARCH
you should now pass the
flag to you target as it is not propagated by CMake anymore. - There is a change in the API in
Quill.h
instead ofquill::Handler*
you should now use
std::shared_ptr< quill::Handler >
and also move it to the created logger.
Improvements
- Add
append_to_filename
parameter when creatingquill::time_rotating_file_handler
andquill::rotating_file_handler
- Fix
Handlers
failing to find the file when the working directory of the application is changed in
runtime. (#247) - When the given output directory of a log file passed to a
Handler
does not exist, it will now get automatically
created. - Support Windows 10 LTSB 2016, 1607 and Server 2016. (#251)
- Add back
backend_thread_sleep_duration
inConfig.h
(#256) - For
quill::rotating_file_handler(...)
andquill::time_rotating_file_handler(...)
thebackup_count
argument is
now default tostd::numeric_limits<std::uint32_t>::max()
- When the logging file is deleted from the command line while the logger is still using it, then a new file will be
reopened for writing. - Added
quill::Clock
which enables taking and converting TSC timestamps to system clock timestamps.
WhenTimestampClockType::Tsc
is used as the default clock type inConfig.h
this class
can also be used to generate timestamps that are in sync with the timestamps in the log
file. (#264) - Both
Unbounded
andBounded
queue modes can now be used without having to recompilequill
library. This is still
not a runtime option, you still need to recompile your target and passQUILL_USE_BOUNDED_QUEUE
as a flag.
See example_bounded_queue_message_dropping.cpp - Added
QUILL_USE_BOUNDED_BLOCKING_QUEUE
option that makes possible to use a bounded queue which blocks the hot
thread rather than dropping messages (#270)
See example_bounded_queue_blocking.cpp - Renamed
backend_thread_max_transit_events
tobackend_thread_transit_events_soft_limit
in
Config.h (#270) - Added
backend_thread_transit_events_hard_limit
in Config.h (#270) - Added
backend_thread_use_transit_buffer
in Config.h (#270) - CMake:
QUILL_X86ARCH
andQUILL_USE_BOUNDED_QUEUE
options have been removed. The users can decide on enabling these
options on their side and quill doesn't need to be recompiled as a library. For example :target_compile_definitions(<target> PUBLIC QUILL_X86ARCH QUILL_USE_BOUNDED_QUEUE)
- Added
quill::remove_logger(Logger* logger)
inQuill.h
. This makes it possible to remove a logger in a thread safe
way. When a logger is removed any associatedFileHandlers
with that logger will also be removed and the files will
also be closed as long as they are not being used by another logger. The logger is asynchronously removed by the
logging
thread after all the messages are written. To achieve this the API had to change to return a
std::shared_ptr< quill::Handler >
instead ofquill::Handler*
. See
example_file_callbacks.cpp - Added
quill::wake_up_logging_thread()
inQuill.h
. This thread safe function can be used to wake up the backend
logging thread on demand. (#280) - Round up queue capacity to the nearest power of 2. (#282)
v2.7.0
Fixes
- Remove references to build directory path from the compiled library's
symbols. (#221) - Fix when compiled as shared library with hidden visibility. (#222)
- Fix equal timestamp log messages appearing out of order. (#223)
- Fix 'rename_file' throwing an exception while being marked
asnoexcept
. (#230) - Fix crash with
std::bad_alloc
and compiler warnings in gcc7.3.1
. (#235) - Any additional compiler definitions will now be propagated to the parent targets when enabling options in CMake. (#235)
Improvements
-
Improved performance and throughput of the backend logging thread by approximately ~25%
-
Add missing
quill::json_file_handler(...)
that creates aJsonFileHandler
inQuill.h
. -
Simplified and refactored the logic in
BoundedQueue
. -
Added the option
do_fsync
which also callsfsync()
during the handler flush to all file handlers. -
Replace
backend_thread_sleep_duration
withbackend_thread_yield
inConfig.h
-
Remove trailing spaces in log levels strings. (#237)
-
Reduce padding in some structs.
-
The default log pattern has changed
to"%(ascii_time) [%(thread)] %(fileline:<28) LOG_%(level_name:<9) %(logger_name:<12) %(message)")
-
Added file event notifiers, to get callbacks from quill before/after log file has been opened or
closed. (#193)
This is useful for cleanup procedures or for adding something to the start/end of the log files.
for exampleint main() { quill::start(); quill::FileEventNotifier fen; fen.before_open = [](quill::fs::path const& filename) { std::cout << "before opening " << filename << std::endl; }; fen.after_open = [](quill::fs::path const& filename, FILE* f) { std::cout << "after opening " << filename << std::endl; }; fen.before_close = [](quill::fs::path const& filename, FILE* f) { std::cout << "before closing " << filename << std::endl; }; fen.after_close = [](quill::fs::path const& filename) { std::cout << "after closing " << filename << std::endl; }; quill::Handler* file_handler = quill::file_handler("myfile.log", "w", quill::FilenameAppend::None, std::move(fen)); quill::Logger* mylogger = quill::create_logger("mylogger", file_handler); LOG_INFO(mylogger, "Hello world"); }
-
Added
QUILL_X86ARCH
inTweakme.h
. When enabled it will attempt to minimize the cache pollution on x86 cpus that
support the instructions_mm_prefetch
,_mm_clflush
and_mm_clflushopt
.To compile when this flag is enabled you should also pass
-march
to the compiler which is required,
you can set this to your oldest cpu architecture among your systems.To enable this option,
DQUILL_X86ARCH
must always be defined in quill library and also in your executable,
for examplecmake -DCMAKE_CXX_FLAGS:STRING="-DQUILL_X86ARCH -march=native"
-
Added
quill:get_root_logger()
which gives quick access to the root logger object and can be used directly in the hot
path.
This gives applications that only wish to use the root logger the convenience of not having to store and
passLogger*
objects anymore.
for example quill existing log macros can be overwritten to not require aLogger*
anymore#define MY_LOG_INFO(fmt, ...) QUILL_LOG_INFO(quill::get_root_logger(), fmt, ##__VA_ARGS__)
-
Added
QUILL_ROOT_LOGGER_ONLY
inTweakme.h
. Define ths if you only plan to use the singleroot
logger object,
When this is defined it will replace the LOG_ macros with the equivalent LOG_ macros but without the need of
passingLogger*
objects anymore.
for example#define QUILL_ROOT_LOGGER_ONLY #include "quill/Quill.h" int main() { quill::start(); // because we defined QUILL_ROOT_LOGGER_ONLY we do not have to pass a logger* anymore, the root logger is always used LOG_INFO("Hello {}", "world"); LOG_ERROR("This is a log error example {}", 7); }
v2.6.0
Fixes
- Fix filepath on Windows when MinGW is used. (#212)
Improvements
- Removed the creation of
static Metadata
objects during initialisation time. #define QUILL_QUEUE_CAPACITY
has been removed.- Added Config option
default_queue_capacity
that can be used to specify the initial capacity of the queue. - When Unbounded queue is used the newly allocated queue will now have enough space to fit any
object. (#215)
v2.5.1
Improvements
- Reduced the allocations performed by the backend worker thread as the same objects are now being reused rather than destroyed.
Complete summary of changes since v2.3.2
In version 2.3.2
when multiple threads performed heavy logging, the backend logging thread incorrectly gave
priority to the logs of the same threads. That made logs from the remaining threads to appear much later or sometimes
never in the log files.
There was a series of fixes and releases to address this.
Below is the summary of the changes from v2.3.2
-
Previously when multiple threads were logging, the backend logging thread would first try to read the log messages of
the same thread until its 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. -
Optimise the backend logging thread to read all log messages from each queue. Ensure all queues
from all active threads are fairly read. -
fmt::basic_memory_buffer
buffer stack size has been reduced. The backend thread shows better performance with
a reduced stack size. This also reduces the risk of a stack overflow when too many log messages are cached.lllllllllll -
Reduced the allocations performed by the backend worker thread as the same objects are now being reused rather than
destroyed. -
Added a config option
backend_thread_strict_log_timestamp_order
. This option enables an extra timestamp
check on the backend logging thread when each message is popped from the queues. It prevents a rare
situation where log messages from different threads could appear in the log file in the wrong order. This flag
is now enabled by default. -
Added a config option
backend_thread_empty_all_queues_before_exit
. This option makes the backend logging thread
to wait until all the queues are empty before exiting. This ensures no log messages are lost when the application
exists. This flag is now enabled by default
v2.5.0
v2.4.2
v2.4.1
Improvements
- Previously the backend worker thread would read all the log messages from the queue but not read the log messages when
the buffer had wrapped around. It will now read all the messages. - Removed the
min_available_bytes
cache from the SPSC queue as an optimisation. It is not needed anymore as we now
read all messages at once instead of reading message by message.
v2.4.0
Improvements
-
Added a config option
backend_thread_strict_log_timestamp_order
. This option enables an extra timestamp
check on the backend logging thread when each message is popped from the queues. It prevents a rare
situation where log messages from different threads could appear in the log file in the wrong order. This flag
is now enabled by default. -
Added a config option
backend_thread_empty_all_queues_before_exit
. This option makes the backend logging thread
to wait until all the queues are empty before exiting. This ensures no log messages are lost when the application
exists. This flag is now enabled by default.