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>
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.
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
* Add test case for #3351 (wrong GMT offset in SunOS/Solaris fallback)
* Fix#3352 (Missing test for Apple / POSIX.1-2024 chooses buggy workaround)
Apple platforms have had the tm_gmtoff-field at least since Mac OS X 10.0,
as are POSIX.1-2024 conforming systems, which are also required to support
it.
This has the unfortunate effect to use the SunOS/Solaris fallback, which
doesn't compute the correct value if the passed value of tm isn't the
current system time, i.e. localtime(::time()) (#3351).
* Fixed GMT offset test
---------
Co-authored-by: toh <toh@ableton.com>
SPDLOG_LEVEL is currently supported to control log levels via
load_env_levels.
This patch adds support for other environment variable names, such as
MYAPP_LEVEL, for load_env_levels.
* Enabled bin_to_hex utest for stdformat, and fixed std::formatter
* fixed usage of \ in macos.yml
* explicitly cast diff variable in test_sink
* moved from ::iterator to decltype
* added fix for custom callbacks
---------
Co-authored-by: Jan Koniarik <veverak@Jans-MacBook-Pro.local>
* Added Mapped Diagnostic Context (MDC) support
* Update include statement
* Optimize string creation
* Fix includes
* Fix padding rules in mdc empty case
* Add comment to describe the use of mdc formatter
* Added a function to add callbacks that are called when a logger is registered
* Fix non captured registration 2 not being properly tested for
* Replace std::list by std::vector
* Remove const refs to shared pointers
* Fix missing header
Reason for the discard_new policy: when there is an overflow, there
is usually some unexpected issue (a bug, or some other unexpected stuff).
And in case of unexpected issue, the first arrived log messages are usually
more important than subsequent ones. For example, some application
keep logging error messages in case of functionality failure, which,
when using async_overflow_policy::overrun_oldest, will overrun the
first arrived messages that may contain real reason for the failure.