Commit Graph

4476 Commits

Author SHA1 Message Date
Christoph Grüninger
fb1227486b [bench] Update Google benchmark to version 1.8.4 (#3579)
Fix CMake warning from more recent versions.
Latest benchmark release support C++11.
Does not increase CMake requirements.
2026-04-07 17:26:55 +03:00
Christoph Grüninger
3c61b051d2 [ci] Update actions/checkout to latest major relese (#3575)
Fix warning that Node.js 20 will stop working in June
2026-04-03 02:19:24 +03:00
Niram7777
45b67eee66 Add constructor for dup_filter_sink with sinks parameter (#3549)
* Add constructor for dup_filter_sink with sinks parameter

* dup_filter_sink switch order construction
2026-03-14 23:23:06 +02:00
Ömer BULUT
1fbc60a5e7 docs: fix SPDLOG_LEVEL env example (#3561)
Co-authored-by: Omer Bulut <omer.bulut@asisguard.com.tr>
2026-03-14 23:18:51 +02:00
Yao Zi
0f7562a0f9 tests: timezone: Provide DST rules when setting TZ on POSIX systems (#3542)
POSIX 2024 defines three formats for the TZ environment variable,

1. Implementation defined format which always starts with a colon:
   ":characters".
2. A specifier which fully describes the timezone rule in format
   "stdoffset[dst[offset][,start[/time],end[/time]]]". Note the
   offset and start/end part could be omitted, in which case one hour
   is implied, or it's considered implementation-defined when changing
   to and from Daylight Saving Time occurs.
3. Geographical or special timezone from an implementation-defined
   timezone database.

POSIX 2024 requires the format 1 and 2 to take precedence over format 3.

In tests/test_timezone.cpp, we set TZ to "EST5EDT" or "IST-2IDT".
According to POSIX, "EST5EDT" should be interpreted as

- timezone "EST", which is five hours behind UTC
- corresponding DST timezone is "EDT", which is one hour ahead of
  standard time
- it's implementation-defined when changing to and from DST occurs

The interpretion is similar for TZ="IST-2IDT". Obviously we're hitting
implementation-defined behavior here, which is inconsistent across
platforms, e.g., musl considers DST is always active if both DST start
and end rules are omitted, thus test_timezone.cpp would fail.

Let's also provide DST rules when setting TZ variables to avoid
depending on implementation-defined behavior.

Fixes: b656d1ceec ("Windows utc_minutes_offset(): Fix historical DST accuracy and improve offset calculation speed (~2.5x) (#3508)")

Signed-off-by: Yao Zi <me@ziyao.cc>
2026-02-24 09:07:37 +02:00
Yancey
d5af52d903 Fix format_string propagation (#3543) 2026-02-23 17:16:21 +02:00
Yancey
1685e694c5 Fix deprecated copy constructor usage of fmt::format_string (#3541)
* Fix deprecated copy constructor usage of fmt::format_string

* Fix copy constructor usage of fmt::wformat_string_t

* Fix usage of std::basic_format_string

* remove spdlog::to_string_view()
2026-02-23 02:10:25 +02:00
Thomas LE BERRE
c49c7cf960 Allow empty DEBUG_POSTFIX property in CMakeLists (#3530) 2026-02-21 00:55:46 +02:00
Gabi Melman
fc7e9c8721 Update common-inl.h
Added missing include
2026-02-09 21:59:45 +02:00
SamareshSingh
566b2d1404 Fix #3525: Make level name matching case-insensitive (#3535)
Modified from_str() to perform case-insensitive comparison for all level names.
This allows environment variables and SPDLOG_LEVEL_NAMES to use uppercase or
mixed case level names (e.g., DEBUG, INFO, Warning) while maintaining full
backward compatibility with existing lowercase names.
2026-02-09 21:58:20 +02:00
Eli Boyarski
6c5d63291a Fix should_log comment (#3534) 2026-02-09 21:54:24 +02:00
Kağan Can Şit
472945ba48 Fix shadow member warning in example file (#3521) 2026-01-15 22:54:27 +02:00
Kağan Can Şit
687226d95d The upd_sink and dist_sink files have been modified to address Passed by value warnings. (#3520) 2026-01-12 09:21:17 +02:00
Kağan Can Şit
f2a9dec029 Fix function arguments names different warnings (#3519)
* helpers-inl.h - load_levels function arguments names different style warning fixed

* async_logger-inl.h - backend_sink_it_ function arguments names different style warning fixed

* spdlog-inl.g - should_log function arguments names different style warning fixed
2026-01-11 21:56:46 +02:00
Kağan Can Şit
309204d53c Rename local variables to avoid shadowing member functions (#3516) 2026-01-11 00:05:14 +02:00
Kağan Can Şit
1774e70082 Add const qualifier to get_time_ and filter_ member functions (#3515) 2026-01-10 23:33:43 +02:00
Kağan Can Şit
d299603e45 Add missing const qualifiers to reference variables (#3514) 2026-01-10 20:07:34 +02:00
Kağan Can Şit
33375433e0 fix: initialize null_atomic_int::value to zero (#3513) 2026-01-09 23:31:01 +02:00
Kağan Can Şit
6b240a892d Replace C-style cast with reinterpret_cast in udp_client (#3509)
* Replace C-style cast with reinterpret_cast in udp_Client

* Update include/spdlog/details/udp_client.h

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Gabi Melman <gmelman1@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-01-04 21:45:53 +02:00
gabime
79524ddd08 spdlog version 1.17.0 v1.17.0 2026-01-04 18:06:01 +02:00
Gabi Melman
b656d1ceec Windows utc_minutes_offset(): Fix historical DST accuracy and improve offset calculation speed (~2.5x) (#3508)
* New utc offset impl for windows and unit tests

* Update utc_minutes_offset()

* Fix warning

* Fix warning

* Fix timezone tests

* Fix timezone tests

* Update tests/test_pattern_formatter.cpp

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update tests/CMakeLists.txt

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Updated utc_minutes_offset() impl

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-01-04 18:01:55 +02:00
gabime
2670f47d02 Fix warning 2026-01-03 17:13:01 +02:00
gabime
09a674b7fc Fix %z when pattern_type_type is utc - should be +00:00 2026-01-03 11:31:34 +02:00
ZaneWong
32dd298dc2 Docs: fix misleading comment in blocking_queue header (#3504) 2025-12-23 19:15:04 +02:00
SamareshSingh
0209b12c50 tests: fix unit tests to not be affected by custom level names (#3492)
The unit tests were failing when users defined custom SPDLOG_LEVEL_NAMES
or SPDLOG_SHORT_LEVEL_NAMES in tweakme.h. This happened because the tests
expected the default level names but were getting the customized ones instead.

For example, with custom short names defined, the test would fail like this:
  REQUIRE( spdlog::level::to_string_view(spdlog::level::trace) == "trace" )
  with expansion: "TRC" == "trace"

This fix undefines these macros in tests/includes.h (right after setting
SPDLOG_ACTIVE_LEVEL) so that unit tests always use spdlog's default level
names, regardless of any customizations in tweakme.h.

Fixes #3466
2025-12-15 09:49:15 +02:00
maordadush
d2100d5d0e Fix: include <fcntl.h> in tcp_client.h to avoid compilation failures on Unix (#3497) 2025-12-15 09:46:34 +02:00
gabime
3f03542d2e Remove warning 4834 suppression 2025-11-30 11:16:53 +02:00
gabime
2c1eafc884 Backport warning fix from fmt head 2025-11-30 11:16:28 +02:00
gabime
878ad2e30b Supress MSVC C4834 warning triggeed by fmt 12.1.0 2025-11-28 20:17:02 +02:00
gabime
c5061bb970 Update LICENSE file 2025-11-28 19:13:40 +02:00
gabime
ea3e747eea Bump fmt to 12.1.0 2025-11-28 19:00:23 +02:00
gabime
b3688ba102 Set IndentPPDirectives to "None" on clang-format 2025-11-28 18:41:08 +02:00
Gabi Melman
6004e3d14a Fix issue #3483 (#3491)
Fix issue #3483
2025-11-28 18:20:28 +02:00
Jérémie Dumas
8806ca6509 Fix UWP detection. (#3489)
* Fix UWP detection.

* Fix conditional compilation for getenv function

---------

Co-authored-by: Jérémie Dumas <jedumas@adobe.com>
2025-11-17 22:34:37 +02:00
SamareshSingh
cdbd64e230 Fix sign conversion warnings in qt_sinks.h (#3487)
Add static_cast to fix compiler warnings when building with
-Werror=sign-conversion and -Werror=shorten-64-to-32:

1. Cast msg.color_range_start/end to qsizetype when passing to
   QString::fromUtf8(), since QString expects signed qsizetype but
   the message fields are size_t (unsigned).

2. Cast msg.level to size_t when indexing into colors_ array, since
   level_enum is a signed int but array indexing expects size_t.

These casts are safe because:
- qsizetype is guaranteed to be the same size as size_t per Qt docs
- color_range values come from valid string positions
- level values are from a small enum range

Fixes #3321
2025-11-14 01:44:43 +02:00
fab4100
88a0e07ad5 Change access scope for ANSI target_file_ from private to protected (#3486)
This change allows for a custom minimal ANSI color sink implementation
that supports, for example, splitting between `stdout` and `stderr` file
streams depending on the log level.  An example application specific
custom sink that realizes this behavior would look like:

```cpp
template <typename ConsoleMutex>
class SplitSink : public sinks::ansicolor_sink<ConsoleMutex>
{
    using Base = sinks::ansicolor_sink<ConsoleMutex>;

public:
    SplitSink(color_mode mode = color_mode::automatic) : Base(stdout, mode) {}

    void log(const details::log_msg &msg) override
    {
        if (msg.level <= SPDLOG_LEVEL_WARN) {
            this->target_file_ = stdout;
        } else {
            this->target_file_ = stderr;
        }
        Base::log(msg);
    }
};
```

Inspired by https://github.com/gabime/spdlog/issues/345 and
https://github.com/eic/EICrecon/issues/456.  This commit aims at reusing
all of the `ansicolor_sink` code with the exception of dynamic target
file selection that can be implemented in application code based on
example above.

Co-authored-by: Fabian Wermelinger <info@0xfab.ch>
2025-11-09 19:38:28 +02:00
Aleksandr
3f7e502859 fix sign-compare warning (#3479) 2025-11-01 18:03:07 +02:00
Ashish Ahuja
dd3ca04a7a set CMAKE_BUILD_TYPE only in top-level project (#3480) 2025-11-01 17:55:59 +02:00
gabime
486b55554f Version 1.16.0 v1.16.0 2025-10-11 15:53:05 +03:00
gabime
1bea38edcc clang-format 2025-10-11 15:50:16 +03:00
gabime
4418909af2 Bump fmt to 12.0.0 2025-10-11 15:18:15 +03:00
Angelio Mason
f1d748e5e3 Remove the fileapi.h include in os-inl.h (#3444)
* Replaced fileapi.h include with windows.h, as instructed in https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-flushfilebuffers
Otherwise this causes compilation error on older sdks.

* Removed the fileapi.h include entirely, since windows.h is already included before

---------

Co-authored-by: MasonAngelio <MasonAngelio>
2025-08-07 23:47:11 +03:00
Vitaly
3edc8036db Run tests in the order they are declared in the source file. (#3451)
Fixes an issue with running tests in random order in Catch2 3.9.0+.
2025-08-07 23:38:29 +03:00
Mihir Patel
9ecdf5c8a1 Added timeout for TCP calls such as connect, send, recv (#3432)
* Now lets test on windows

* I guess testing on windows passes.

* Update tcp_client-windows.h

Added default value to argument

* Final edit

* Update tcp_client-windows.h

Changed improper misplaced includes.
2025-07-17 23:47:35 +03:00
Gabi Melman
737347d2df Update linux.yml 2025-07-16 09:55:57 +03:00
Alexander
4f2b3d52f9 Update README.md (#3437)
* Update README.md

add example showcasing 2 loggers and `spdlog::set_level()` 
which set level not only to default logger, but to all registed loggers

* Update README.md

* simplify

* simplify
2025-07-16 08:59:51 +03:00
Joshua Chapman
4397dac510 chore(cmake): add option to override CMAKE_DEBUG_POSTFIX (#3433)
This will make it possible to use the pkg-config with CMake debug build.
2025-07-08 22:52:42 +03:00
Gabi Melman
6fd67ce169 Update windows.yml
remove msvc 2019 build
2025-07-06 10:08:55 +03:00
Gabi Melman
4619e18a16 Update windows.yml 2025-07-06 09:53:42 +03:00
Gabi Melman
a6215527f4 Fix ringbuffer tests for newline (#3436) 2025-07-06 08:38:48 +03:00