Releases: gabime/spdlog
Version 1.14.1
Version 1.14.0
- Updated bundled fmt to version 10.2.1.
- Mapped Diagnostic Context (MDC) support by @massimiliano96 in #2907.
MDC is a simple map of key->string values stored in thread local storage whose content will be printed by the loggers.
Usage example:
#include "spdlog/mdc.h"
..
spdlog::mdc::put("mdc_key_1", "mdc_value_1");
spdlog::info("Hello, {}", "World!"); // => [2024-04-26 02:08:05.040] [info] [mdc_key_1:mdc_value_1] Hello, World!
- Add milliseconds support to stopwatch by @brodao2 in #3034
- Add
std::string_view
overloads for logger accessor by @BenLeadbetter in #3023 - Make async_logger::flush() synchronous - wait for the flush operation to complete before returning by @walkerlala in #3049
- Use _stat() on Windows to be more UTF8 friendly by @liubing in #2978
- Add details about how compile time macros work by @egaban in #2981
- Fix typos found by codespell by @DimitriPapadopoulos in #3011
- Expose the flusher thread object to user in order to allow setting of thread name and thread affinity when needed by @cohdan in #3009
- Fix the problem of compilation failure under MINGW by @NU-LL in #3022
- Add missing include in circular_q.h by @magnus-nomono in #3026
- Fix #3038 by @Tomas-Zhu in #3044
- Don't remove previous defaullt logger from registry in set_default_logger. Fix #3016
- Remove the legacy AnalyzeTemporaryDtors option from .clang-tidy. by @shaharv in #3048
- Updated INSTALL.md has to better reflect compiler info by KaganCanSit in #3052
- Fixed README.md example by @darallium in #3066
Full Changelog: v1.13.0...v1.14.0
Special thanks to @tt4g for helping with community questions and issues.
Version 1.13.0
Release Notes
Enhancements
- Qt Sink: Allow for darker colors for light backgrounds (#2817). Thanks to @krawq.
- Set
CMAKE_BUILD_TYPE
only for single-config generators (#2839). Thanks to @moritz-h. - Provide
spdlog_header_only
in build directory export (#2846). Thanks to @robertmaynard. - Add
SPDLOG_TO_VERSION
to compare spdlog version (#2853). Thanks to @kegechen. - Support
async_overflow_policy::discard_new
(#2876). Thanks to @walkerlala. - Make
syslog_sink.h
'ssyslog_prio_from_level
protected (#2918). Thanks to @shannonbooth. - Fix OS availability check of
pthread_threadid_np
for iOS (#2897). Thanks to @lowdesertpunk. - Add
.git-blame-ignore-revs
to ignore clang-format related commits (#2899). Thanks to @lowdesertpunk. - Match
SPDLOG_CONSTEXPR_FUNC
toFMT_CONSTEXPR
(#2901). Thanks to @kkraus14.
Bug Fixes
- Check
fd_
is not nullptr infile_helper
to prevent possible crash if disk is full (#2972). - Fix encoding issue in qt_sinks (#2862). Thanks to @neothenil and @tt4g .
- Fix wrong thread_id (TID) in
systemd_sink.h
(#2919). Thanks to @M010. - Update
example.cpp
to fix the vector issue inbin_example
(#2963). Thanks to @zhuzhzh. - Fix MSVC compile flag for no exceptions (#2974). Thanks to @Programicus.
- Fix bug in
circular_q::size()
(#2820). - Fix link to fmt license file (#2967).
Maintenance
- Added and updated various tests for
circular_q
. - Removed obsolete part from CMake configuration files (#2871). Thanks to @albert-github.
- Removed
policy_max
fromcmake_minimum_required(..)
. - Updated
clang-format
to google style and updated various formatting scripts. - Bumped catch2
Special thanks to @tt4g for helping with community questions and issues.
Version 1.12.0
- Support for external fmtlib versions 10.x (#2694). Thanks @H1X4Dev and @mguludag.
- Better support for std::format (#2359, #2544, #2680, #2688). Thanks @eli-b , @sylveon and @bachittle.
- Added new qt color sink. Logs to
QTextEdit
widget with some nice colors. - Update
#include
to a deprecated fmt header (#2545) .Thanks @kromain. - Fixes and impovements to
dup_filter_sink
(#2549, #2563). Thanks @zydxhs and @zhuyadong. - Fix unnecessary empty backtrace begin/end logs (#2568). Thanks @koldi.
- Fixed variable name in
msvc_sink
(#2573). Thanks @naddu77. - Add system includes (
SPDLOG_SYSTEM_INCLUDES
) cmake option (#2575). Thanks @dpayne. - Improve dequeue of the async queue (@2587, #2588 ). Thanks @alokpr.
- Fix
tcp_client
sink for FreeBSD (#2590). Thanks @segoon. - Support linux/musl libc (#2589). Thanks @kraj.
- Support
newlib C
library configurations without tm_gmtoff field (#2600). Thanks @igrr. - Fix type of event id in win_eventlog_sink (#2598). Thanks @Tagl.
- Fix -Wshadow warnings in
spdlog::sinks::dist_sink
(#2599). Thanks @robinlinden. - Spelling corrections (#2606, #2732). Thanks @albert-github and @zencatalyst.
- Add
sync()
function to file_helper (#2343). Thanks @espkk. - Add a trivial
callback_sink
(#2610). Thanks @maghorbani. - Fix unexpected delimiter at start of line in to_hex formatter (#2627). Thanks @starsunyzl.
- Fix MinGW build issue on example (#2642). Thanks @zEuS0390.
- Add optional TID definition to the
systemd sink
(#2619). Thanks @chardin-cpi. - Added
apply_logger_env_levels()
(#2648, #2649). Thanks @afshinpir. - Support utf8 in
msvc_sink
(#2651). Thanks @Demonese. - Better handling of utf to wchar (66407f5).
- Use catch v3 for tests (#2656, #2659). Thanks @xvitaly and @seker.
- New kafka sink (#2655). Thanks @vbirds and @SpriteOvO.
- Fix os namespace in systemd_sink.h (#2668). Thanks @MyNameIsLame.
- Enable
systemd_sink
tests in linux pipeline (#2669). Thanks @MyNameIsLame. - Fix stdout_sink_base::log's
fflush()
behaviour inconsistency (#2646). Thanks @25077667. - Fix for missing pthread_threadid_np in macOS < 10.6 and PowerPC (#2715). Thanks @barracuda156.
- Fix ringbuffer_sink moving warning (#2722). Thanks @jamesruan.
- Update INSTALL doc (#2775). Thanks @7starsea.
- Fix warning in qt_sinks.h (#2781). Thanks @dayfixer.
- Remove IPv4 limitation from tcp_client (#2790). Thanks @Simon-Janos.
- Fix android sink when message is not loggable (#2801). Thanks @lucasrangit.
Special thanks to @tt4g for helping with community questions and issues.
Version 1.11.0
- Update to fmt lib version 9.1.0 #2346, #2485, #2512, #2517 . Thanks @sylveon, @YunchengLiu, @tt4g, @tycho and @vitaut
- Fix template instantiation warning #2336 . Thanks @aengusjiang
- Event handlers improvements #2342, #2375 . Thanks @espkk and @kslattery
- Allow modifying the used Android buffer ID #2358. Thanks @tiolan
- Fix clone in async test #2364. Thanks @stkw0
- Custom formatting optimization #2365. Thanks @conr2d
- Fix C++14 builds for gcc 4.x (#2333) #2372 . Thanks @kslattery
- Add minor version to CMake's
SOVERSION
#2376 - Allow compilation with FMT_ENFORCE_COMPILE_STRING #2381. Thanks @john4744
- Fix
pkg-config
generation #2383. Thanks @alexshpilkin - Remove unused code from
null_mutex
#2385. Thanks @panzhongxian - Fix redundant
std::move
#2396. Thanks @polesapart - Remove the empty file if in first period in hourly logger #2386. Thanks @panzhongxian
- Add
reset_overrun_counter()
function to the async logging #2399 Thanks @bergen4 - Set C++20 in CMake when SPDLOG_USE_STD_FORMAT option is turned on #2402. Thanks @cookcocck
- Fix mingw test #2415. Thanks @neheb
- Support for any
std::chrono::duration
type inflush_every(..)
#2439. Thanks @LucasChollet - Fix implicit casting of level_enum #2443. Thanks @ibmibmibm
- Comment fix #2445. Thanks @Hish15
- Fix gcc 4.x build #2449. Thanks @Simon-Janos
- Add openSUSE installation instructions #2468. Thanks @LorenDB
- Fixed missing include file in
stopwatch.h
#2434. Thanks @fabianbuettner - Support for omitting source info by defining
SPDLOG_NO_SOURCE_LOC
#2476. Thanks @nigels-com - Added
SPDLOG_BUILD_PIC
build option to CMake #2475. Thanks @nigels-com - Fix include
windows.h
#2495. Thanks @panicgh - Workaround gcc 12 warnings #2498, #2499 . Thanks @offa
- Migrate to Github Actions CI #2500. Thanks @offa
- Replace iterator difference with
std::distance
#2509 Thanks @kin4stat - Export targets file to build directory at configure time #2514, #2515. Thanks @puneetmatharu
- MongoDB sink improvements #2519. Thanks @sandorzm
- Fix shadow warning in dist_sink #2431. Thanks @MohammadKanan for reporting.
- Fixed msvc warning C4800 in win_eventlog_sink
- Check
IsDebuggerPresent()
inmsvc_sink
before doing actual work #2408. To use old behavior pass false to themsvc_sink constructor
. Thanks @DominikGrabiec and @sylveon
Special thanks to @tt4g for helping with community questions and issues.
Version 1.10.0
- Bump fmt to version 8.1.1.
- Added file event handlers #2165, #2169 Thanks @seker.
You can get callbacks from spdlog before/after log file has been opened or closed.
This is useful for cleanup procedures or for adding something to the start/end of the log files. Example:
void file_events_example()
{
// pass the spdlog::file_event_handlers to file sinks for open/close log file notifications
spdlog::file_event_handlers handlers;
handlers.before_open = [](spdlog::filename_t filename) { spdlog::info("Before opening {}", filename); };
handlers.after_open = [](spdlog::filename_t filename, std::FILE *fstream) { fputs("After opening\n", fstream); };
handlers.before_close = [](spdlog::filename_t filename, std::FILE *fstream) { fputs("Before closing\n", fstream); };
handlers.after_close = [](spdlog::filename_t filename) { spdlog::info("After closing {}", filename); };
auto my_logger = spdlog::basic_logger_st("some_logger", "logs/events-sample.txt", true, handlers);
}
- Fixed rotating file sink: when disk is full log rotation resulted zero size log files. #2261. (thanks @kishorekrd for reporting).
- Added new udp_sink #2090. Thanks @CJLove
- (Experimental) Option to depend on std::format instead of fmtlib (set
SPDLOG_USE_STD_FORMAT
and use C++20). #2170 Thanks @sylveon . - Improved file name for hourly file sink #2047. Thanks @seker .
- Added code location information for error handler #2048. Thanks @D-r-P-3-p-p-3-r .
- Fixed qt_sinks ctor #2056. Thanks @mguludag .
- List Debian instructions in the README #2057. Thanks @mr-c ,
- Updated to latest Travis CI Build Status #2094. Thanks @jspraul .
- Fixed unhandled errors in udp sink. #2096. Thanks @mmarkeloff .
- CMake improvement regarding
cmake_minimum_required
and policy. #2098. Thanks @reddwarf69 . - Fixed mongo_sink compile in older gcc versions #2102 . Thanks @yzz-ihep .
- Remove mutable keyword from mutex_ member in of sinks. #2140 . Thanks @sunlong169 .
- Fix typos #2171. Thanks @rex4539 .
- Fixed udp sink build on FreeBSD #2172. Thanks @keith-dev .
- Avoid c-style casting in stdout sinks. #2179. Thanks @ibmibmibm .
- Fixed
tweakme.h
compile error under msvcs whenSPDLOG_FUNCTION
is defined #2182. Thanks @Light3039 . - Fixed compiling errors on AIX #2181. Thanks @lisr .
- Fixed runtime when build with -fsanitize=cfi #1972. Thanks @bansan85 .
- Remove extraneous semicolon #2190. Thanks @sylveon.
- Added example how to replace default logger. #2194. Thanks @rioki .
- Fixed usage of ranges and
to_hex
in the same compile unit #2195. Thanks @patrickroocks . - Reduce warnings with pedantic compiler -Wuseless-cast #2216. Thanks @vnepogodin .
- Support using
std::span
into_hex
#2228. Thanks @timblechmann . - Reset current size if rotated files on open #2234. Thanks @SpriteOvO .
- Allow forward-declaration of level_enum #2245. Thanks @daverigby .
- Call localtime() only if
pattern_formatter
really needs it #2246. Thanks @doug1234 . - Removed unneeded spaces from code. #2249. Thanks @PixelParas .
- Added a few missing files/directories to the gitignore #2255. Thanks @LeonBrands .
- Fixed issue #2201 (Pattern width is not applied for missing source information). #2269. Thanks @kyuheon-kr .
- Limit max number of rotating files to 200000. (Fixed #1905). Thanks @surfycui (#2273)
pattern_formatter
: fix reorder-ctor warning #2278. Thanks @adriweb .- Fixed spdlogConfig.cmake when built with
SPDLOG_FMT_EXTERNAL_HO
#2300. Thanks @adamcalhoon . - Fixed
fopen_s(..)
error handling whenPREVENT_CHILD_FD
is defined #2305. Thanks @nUl1. - Fixed compiler error when building on Windows with #define UNICODE #2317. Thanks @risa2000 .
- Added option to enable formatting of systemd sink #2324, #2320. Thanks @Delgan .
- Added optional "ident" argument to systemd sink constructor #2328. Thanks @Delgan .
Special thanks to @tt4g for his support in answering community questions and issues.
Version 1.9.2
- Fixed clang compiler errors when using spdlog in c++20. Thanks @dkavolis (#2037, #2034).
- Fixed the Qt sinks to accurately trim the newline chars. Thanks @MadMax411 (#2015).
- Improved and simplified Qt sinks implementation. Thanks @mguludag (#2016, #2018).
- Fixed macro
SPDLOG_LEVEL_NAME_xxx
to always translate to thespdlog
namespace. Thanks @ashley-b for reporting (#2022). - Fixed typo in readme. Thanks @p-ranav (#2024).
- Fixed the MongoDB sink compilation in c++11. Thanks @jabartek (#2025).
- Fixed double include of same file in
thread_pool.h
. Thanks @hbwang15 (#2026). - Ensure that the CMake exported package is relocatable. Thanks @daverigby (#2029).
- Remove
std::distance
usage for possible performance gain. Thanks @neheb (#2030). - Support of inclusion of
bin_to_hex.h
in any order withspdlog.h
. Thanks @dmerkushov (#2035). - Fixed install instructions for "header only" dir. Thanks @madeso (#2036).
Version 1.9.1
-
Support for {fmt}'s compile time validation of format strings (#2008). Thanks @dkavolis !
In C++20:spdlog::info("{:d}", "bad format_arg"); // should not compile
In C++14/17 - format string can be validated at compile time using FMT_STRING:
spdlog::info(FMT_STRING("{:d}"), "bad format_arg"); // should not compile
-
Fixed compilation error in Clang 13 with C++20 (#2011, #2013) Thanks @sjanel !
Version 1.9.0
What's new
- Support for {fmt} lib version 8.x.
- New MongoDB sink #1981 . Thanks @mguludag.
- New QTextEdit and QPlainTextEdit sinks #1986. Thanks @mguludag.
Fixes and Improvements
- Fixed #1790 (build failed with v140_xp, v141_xp toolset flags ). Thanks @LonghronShen.
- Fixed #1916 (fix Xcode compiler warning). Thanks @haifengkao.
- Made mutex member variable mutable #1918. Thanks @matt77hias.
- Changed c-style casts to reinterpret casts in tcp_client #1924. Thanks @ lnovey .
- Fix #533 . Rethrnow non std exceptions.
- Avoid harmless warning about unreachable statement in MSVS build #1930. Thanks @vadz.
- Fixed warning about testing _WIN64 which might be undefined #1931. THanks @vadz.
- Small code improvement (std::find) #1933. Thanks @neheb .
- Added support for CMake policy CMP0077 #1946. Thanks @JB-55,
- Allow compilation with nvc++ (and possibly PGI) #1958. Thanks @mlund .
- Fixed C++20 build resulting in deprecated implicit copy assignment operator warning #1961. Thanks @JB-55.
- Fix signed/unsigned mismatch in VS #1970 . Thanks @bansan85.
- Use std::function for the global error handler #1971. Thanks @SpriteOvO .
- Fixed dup sink compile warnings in older compilers with back_inserter.
- Added a color-terminal type #1984 to the color terminals list - to show colors in in RISC-V64 machines. Thanks @hctym1995.
Version 1.8.5
Fix compiling with C++17: remove constexpr
on level_string_views. Thanks @stevenlunt (#1889).