Releases: gabime/spdlog
Version 1.4.2
Fix some issues discovered by users:
- Set additional CPACK variables for RPM generator (#1246). Thanks @tcraigtyler.
- Fix compile when
SPDLOG_WCHAR_FILENAMES
is defined (#1249 ). - Fix
stdout color sink
under Windows to better handle cases when no console available (#1250). - Fix windows compile error where std::max is overriden by a macro. (#1251, #1252). Thanks @bsergean.
- CMakeLists.txt: Moved the installed lib to
CMAKE_INSTALL_LIBDIR
(#1253). Thanks @DasRoteSkelett. - CMakeLists.txt: Fixed pkg-config generation (cf2bf48, fb70eca). Thanks @SammyEnigma.
Version 1.4.1
Fix few issues discovered by users of 1.4.0
Version 1.4.0
Improvements
- spdlog can now be compiled as a static or shared lib (thanks @DavidZemon for the help).
Using the compiled lib improves greatly compile times when using spdlog and is very recommended.$ cd spdlog && mkdir build && cd build # Build is static lib (pass -DSPDLOG_BUILD_SHARED=ON for building as shared lib) $ cmake .. && make -j
- Upgraded to the latest and greatest fmt library version 6.0.0. Thanks @tgpfeiffer (and to @vitaut for fmt!).
- Support for -fno-exceptions (disabled by default). Enabling this will replace all throw() statements in spdlog with std::abort(). To enable, pass
-DSPDLOG_NO_EXCEPTIONS=ON
to CMake before building spdlog. - support for building spdlog with meson. Thanks @mensinda
- Backtrace support - store debug/trace messages in a ring buffer to display later on demand. Very useful (thanks @MathijsV for the idea):
spdlog::enable_backtrace(32); // create ring buffer with capacity of 32 messages
// or my_logger->enable_backtrace(32)..
for(int i = 0; i < 100; i++)
{
spdlog::debug("Backtrace message {}", i); // not logged yet..
}
// e.g. if some error happened:
spdlog::dump_backtrace(); // log them now! show the last 32 messages
// or my_logger->dump_backtrace(32)..
- Systemd support. Thanks @WarShoe (#1027)
- Support for cleaning old files in daily_logger.
- Numerous CMake build improvements. Thanks @DavidZemon , @jktjkt , @ksergey , @mnemotic , @cneumann , @dpacbach , @FrancoisChabot , @myd7349 , @matt77hias
- Better support for various Unix BSDs (DragonFly, NetBSD, FreeBSD, OpenBSD). Thanks @jbeich (#1234)
- Provide source location support for systemd sink. Thanks @jbelloncastro (#1122)
- Added fmt::(w)string_view support. Thanks @matt77hias (#1139)
- Add option to force color output without TTY . Thanks @psalz (#1175)
- Add more overloads to spdlog::log and spdlog::logger::log. Thanks @sylveon (@1169)
- Add public API spdlog::initialize_logger for create loggers manually. Thanks @tt4g (#1035)
- Expose should_do_colors_ in ansicolor_sink.h. Thanks Florian Wörter (#1022)
- Add tweak support for user short level names. Thanks @MFornander (#996)
- Add method to filesinks to return filename. Thanks @markniebur (#978)
- rotating_sink: Add option to rotate on open. Thanks @pwm1234 (#958)
- Allow filename/line number at all levels. Add function name %! support. Thanks @possiblyhuman (#956)
- New dups_filter sink -duplicate message removal sink. It will skip a message if previous one is identical and less than "max_skip_duration" old.
- New '%o', '%i', '%u', '%O' format flags - Display elapsed time in mills/micros/nanos/seconds since previous message.
- Some minor pattern formatter performance improvements.
Fixes
- Fix Wundef in os-inl.h. Thanks @AMS21 (#1189)
- Fix use of old style cast in os-inl.h. Thanks @AMS21 (#1164)
- Prevent NEAR and FAR macro definitions from leaking on Windows platforms. Thanks @PeterTh (#1142)
- Fix syslog output. Thanks @mattiasj-axis (#1140)
- Fix
msg.time
in daily_file_sink. Thanks @s-shin (#1129) - Fix missing include for null_mutex in rotating_file_sink.h. Thanks @casperevan (#1120)
- Fix warning: redundant move in return statement. Thanks @MarkKoester (#1119)
- Fix use of incomplete type in stdout sinks. Thanks @DanielChabrowski (#1118)
- Fix deprecation warnings in filename_to_str and improve performance of wbuf_to_utf8buf. Thanks @sylveon (#1127)
- Update README.md. Thanks @martinkrammer (#1057)
- Remove extra semicolon. Thanks @Jerry-Ma (#1202)
- Fix unexpected log macro expansion. Thanks @db-panda (#1055)
- Namespace qualify stat functions. Thanks @p-po (#1045)
- Fix typo in Android logger. Thanks @romainthomas (#994)
- Remove unnecessary log function. Thanks @DanielChabrowski (#988)
- Allow custom formatter in sink's ctor. Thanks @DanielChabrowski (#986)
- Fix shadowed parameter. Thanks @ZGCDDoo (#984)
- Update log_msg.h. Thanks @scribam (#969)
- Fix #benchmark link error. Thanks @myd7349 (#962)
- Fix typo in file_helper.h. Thanks @brridder (#955)
Version 1.3.1
Fix few issues found by 1.3.0 users:
Version 1.3.0
Improvements
-
Upgraded to the latest and greatest fmt library version 5.3.0.
-
New API for default logger
spdlog::trace(..)
,spdlog::debug(..)
,spdlog::info(..)
, etc.
For convenience, spdlog now creates a default global logger (to stdout, colored and multithreaded).
It can be used easily by callingspdlog::info(..), spdlog::debug(..), etc
directly without any preparations.It's instance can be replaced to any other logger (shared_ptr):
spdlog::set_default_logger(some_other_logger); spdlog::info("Use the new default logger");
-
Alignment support in log patterns.
Each pattern flag can be aligned by prepending a width number(upto 128).
Use-
(left align) or=
(center align) to control the align side:align meaning example result %<width><flag>
Align to the right %8l
" info" %-<width><flag>
Align to the left %-8l
"info " %=<width><flag>
Align to the center %=8l
" info " -
Support for logging source filename, line number, and function name (thanks @possiblyhuman for contributing to this effort)
flag meaning example %@
Source file and line (use SPDLOG_TRACE(..),SPDLOG_INFO(...) etc.) my_file.cpp:123 %s
Source file (use SPDLOG_TRACE(..),SPDLOG_INFO(...) etc.) my_file.cpp %#
Source line (use SPDLOG_TRACE(..),SPDLOG_INFO(...) etc.) 123 %!
Source function (use SPDLOG_TRACE(..),SPDLOG_INFO(...) etc. see tweakme for pretty-print) my_func -
Support for compile time check of log levels using
#define SPDLOG_ACTIVE_LEVEL <level>
.
UseLOG_TRACE(..)
,LOG_DEBUG(..)
,LOG_INFO(..)
, etc. to enable.
Those macros check at compile time the log level and translate to empty statement if the log level is not high enough. Even if a log macro evaluate to a log call, the macro will check at runtime the level before evaluating its arguments.
So for example the following won't evaluatesome_costly_function()
because the logger's level is error:#define SPDLOG_ACTIVE_LEVEL SPDLOG_LEVEL_DEBUG #include "spdlog/spdlog.h" .. spdlog::set_level(error); SPDLOG_DEBUG("Some costly arg: {}", some_costly_function());
-
Numerous small performance optimizations.
-
Global option that disables global registration of loggers
set_automatic_registration(bool)
. Thanks @pabloariasal (#892). -
Optimize logging of C strings by using
string_view
to avoid unnecessary copy. Thanks @peergynt (cb71fea). -
Use google benchmark to test latencies.
Fixes
logger::error_handler()
should be const (#881, thanks @shoreadmin for reporting)- Cleanup header file: remove log_msg.h include from fmt_helper.h. Thanks @peergynt (1b391cc)
- Fix log_msg constructor doesn't initialize all fields (#888. Thanks @curiouserrandy for reporting).
- Change
log_msg&&
tolog_msg&
params. Thanks @rwen2012 (794a636) - Fix typo in Android example. Thanks @zamazan4ik (f5a2725)
- Fix Compiling error VS2017 #902 (Thanks @JaNurz for reprting).
- Fix thread id is prefixed with zeros #908 (Thanks @klrakiranpradeep for reporting).
- Fix OSX build. Thanks @DanielChabrowski (c7f42d1).
- Fix and optimize usage of
fmt::internal::count_digits(..)
for better support 32/64 bits. Thanks @DanielChabrowski (c7f42d1, f1ab6fe). - Better handling of rotation errors (b64e446).
- Fix exceptions on file size calculation on Windows XP x64 and Windows Server 2003 x64. Thanks @lestera (#926).
- Do not attempt to default operator= when it is implicitly deleted. Thanks @dpacbach (63a475d).
- Make an implicit cast from int --> uint32_t explicit. Thanks @dpacbach (a6152eb).
- Enable testing in the Travis config file. Thanks @dpacbach (f5dc166).
- Fix the text alignment in the example. Thanks @bzindovic (d6086da4856df510657ffe4ef6b894e902b4b83).
- Fix typos. Thanks @peergynt (ce8cf1e).
- Fix handling of external fmt lib in cmake. Thanks @cneumann (084bc72).
- Fix VC WinRT compilation. Thanks @taniey for reporting (@948).
- Fix typo in file_helper.h. Thanks @brridder (fb702f9).
Version 1.2.1
This fixes a compilation error of dist_sink.h (#864) . Thanks @DimRochette !
Version 1.2.0
Improvements
- Upgraded to latest fmt version 5.2.1.
- Binary data logging using
spdlog::to_hex(binary_data)
. Many types ofstd::container<char>
can be logged in hex. See usage examples. - Added
logger->clone()
to ease the creation of new loggers from an existing one. - Numerous micro optimizations across the lib.
- Added
set_sinks
method to dist_sink for atomic updating set of sinks in dist_sink. Thanks @jwnimmer-tri . - Improved CmakeLists.txt to better handle third-party usage. Thanks @taketwo .
Fixes
- Fixed wchar logging (supported only in windows. #851 , #764).
- Fixed registry test. Thanks @DanielChabrowski .
- Removed invalid files from tests.sln. Thanks @yhchen .
- Some fixes to console_globals.h includes. Thanks @DanielChabrowski
- Don't deny access to log files from other processes under windows. Thanks @eruiz.
- Pessimizing move remove. Thanks @maciekgajewski
- ansicolor_sink.h - add missing sink include. Thanks @AlexanderDalshov .
- Improved rotating sink error handling.
- Fixed Readme. Thanks @blackball .
- Fixed some clang tidy warnings.
Version 1.1.0
Bug fixes
- Fixed android sink compilation. Thanks @rajesh-p .
- Fixed race condition in async-factory.
- Fixed bug in
spdlog_ex
implementation .Thanks @gajanak for reporting. - Fixed race condition in the unit tests.
- Fixed compiler warnings under OSX. Thanks @baishuai .
Improvements
- Some micro optimizations.
- Improve and fix CMake issues. Thanks @DanielChabrowski .
- Improve and fix travis-ci issues. Thanks @DanielChabrowski .
- Added
overrun_counter()
to the async thread pool queue - returns # of messages overrun under theoverrun_oldest
mode. Thanks @indiosmo . - Fixed some clang tidy warnings.
Version 1.0.0
Version 1.0.0 is a major release with numerous features and improvements.
It contains some breaking API changes that are not compatible with 0.x versions (see below).
Highlights
-
Include what you need: Reduce compilation times by including only the minimum required. Users can now to include only the actual sinks/features they need from
spdlog/sinks
folder. -
Upgrade to fmt lib version 5.1 - thanks @vitaut for this great lib.
-
Support for custom formatting per sink - each sink can have it's own formatting and level using
sink->set_pattern(..)
orsink->set_formatter(..)
. -
async logging - thread pool - async loggers now share a global thread pool by default.
Creating and destroying async loggers is cheap now. This is in contrast to previous versions were creating async loggers was expensive, since each logger instance had its own worker thread and queue.
The global thread pool and can be configured usingspdlog::init_thread_pool(queue_size, worker_threads)
or created directly using make_shared. -
periodic flusher:
spdlog::flush_every(seconds)
to periodically flush all registered loggers. -
Improved performance - by caching some recently used values in the pattern formatter.
-
Ability to add sinks to a logger after its creation (but it is not thread safe to do so - so use with caution).
Breaking changes
-
Include what you need. For example to use basic_logger add
#include "spdlog/sinks/basic_file_sink.h"
(see example in readme). -
To use async loggers - include
"spdlog/async.h"
-
Replaced
set_async_mode(..)
with factory template. For example:
auto logger= spdlog::rotating_logger_mt<spdlog::async_factory>(...);
-
Removed
printf
support. -
Removed warmup/teardown functions from async.
-
Custom sinks inheriting from
sinks::base_sink
need to format (if needed) the message before sending to their target. For example
void sink_it_(const details::log_msg &msg) override
{
fmt::memory_buffer formatted;
sink::formatter_->format(msg, formatted);
// sink the formatted
...
}
-
Added
clone()
virtual function to the formatter interface. -
Removed support for
#define SPDLOG_NO_REGISTRY_MUTEX
Change log
See here the complete list of changes.
Version 0.17.0
Summary
- Improvements in color output impl - thanks @Qix-
- Fixed spelling - thanks @rcarmich
- New function to convert level_enum from string - thanks @fegomes
- Support for custom EOL per formatter - thanks Emad William Farag
- Make set_color public in wincolor_sink to retain configurability - thanks Benjamin Schindler
- Fix compilation error with GCC 8 - thanks @ColinDuquesnoy
- CMake improvements - thanks @DanielChabrowski , @grzadr and @yisonPylkita
- Bumped bundled fmt version to 4.1.0
- Fixed tests for older gcc compilers
- Moved to clang source code formatter - thanks @DanielChabrowski
- Fixed many clang-tidy warnings - thanks @DanielChabrowski
- Fix implicit conversion warnings - thanks @tbastos
- Added Added: g3log, log4cplus, log4cpp, p7. Changes: boost, easylogging, g2log to bench - thanks @kasru
- Support for color formatting. using the %^ and %$ format flags.
- Added new sink to contrib: step_logger - thanks @Puasonych
- Replaced the lockfree queue with bounded, locked queue - this greatly improves CPU usage and memory footprint in async mode (with some cost to latency due to the mutex locking).