Comments (2)
So I have investigated the issue, this is due to the changes made to spdlog
sinks in particular since v1.0.0
see here, where sinks are now allowed to have their own formats.
The code that causes this is here: https://github.com/gabime/spdlog/blob/v1.0.0/include/spdlog/details/logger_impl.h#L40-L51, so now setting format on the logger basically just forwards and sets all its associated sinks with the given format, which consequently also means that the ordering of setting the format on the loggers actually now matters if they share some common sinks, which is the case in your given TOML example. I must say having both loggers and sinks to be allowed setting format makes the situation pretty complicated, in particular this makes the config even less declarative.
Unfortunately currently spdlog_setup
doesn't support setting format on the sinks, which would likely become the recommended practice when it gets implemented. For now, to get back the behavior, you would have to set different sinks on each logger as shown below:
[[sink]]
name = "console_simple"
type = "stdout_sink_mt"
[[sink]]
name = "console_complex"
type = "stdout_sink_mt"
[[pattern]]
name = "complex"
value = "[%Y-%m-%d %T,%e %n] <%l> %v"
[[pattern]]
name = "simple"
value = "%n %v"
[[logger]]
name = "other"
sinks = ["console_simple"]
level = "debug"
pattern = "simple"
[[logger]]
name = "root"
sinks = ["console_complex"]
level = "trace"
pattern = "complex"
Hope this clarifies the issue.
from spdlog_setup.
Hi sorry for the late reply, I have tested the above and this is indeed true.
The last tag that works is v0.3.0-alpha.1
, but this requires a pre-v1.x spdlog
set-up. If you prefer to get a working logging output as priority and do not require spdlog
v1.x
, then the easiest way to do so is to:
git checkout v0.3.0-alpha
git submodule init && git submodule update --recursive
mkdir -p build
cd build
cmake ..
cmake --build .
sudo cmake --build . --target install
This will give you spdlog_setup
v0.3.0-alpha.1
+ spdlog
v0.16.3
in /usr/local/include
(be careful this might overwrite existing spdlog
files), which I have tested to be working with your given example.
Meanwhile I will investigate if I have committed a bug (or might be upstream) at the current tag. Thanks for reporting the find!
from spdlog_setup.
Related Issues (20)
- Where to store config file HOT 5
- Clean up README
- v0.3.0-alpha.3 HOT 1
- Failed to initialize logger from file if one of the loggers already exists (spdlog 1.3.1) HOT 1
- Support for async logging HOT 5
- Getting " error LNK2005" on Windows HOT 4
- Expose global and/or per-logger flush policy HOT 1
- external spdlog package not found HOT 4
- Fatal error: can't write 37 bytes to section .text too many sections HOT 1
- To work with latest fmt library version fix needed
- Feature request: yaml configuration file
- Properly "link" with the right spdlog target
- `setup_syslog_sink` function causes compilation problem with recent spdlog releases
- Conan Support
- Multiply defined symbols linker error when using with compiled spdlog lib
- C++ 20 compilation problem HOT 1
- spdlog_setup tries to find spdlog but doesn't exist
- Windows build problem C:2280
- set logger type (sync/async) failed with exception
- [[thread_pool]] has bug HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from spdlog_setup.