-
Notifications
You must be signed in to change notification settings - Fork 41
-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pattern takes the last entry #32
Comments
Hi sorry for the late reply, I have tested the above and this is indeed true. The last tag that works is 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 Meanwhile I will investigate if I have committed a bug (or might be upstream) at the current tag. Thanks for reporting the find! |
So I have investigated the issue, this is due to the changes made to 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 [[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. |
Hello.
It seems that different loggers cannot have different patterns anymore (they could previously, but not in the present version of the code, I updated yesterday after a few months). I couldn't spot in which commit the difference appeared.
Here is a code to reproduce the issue (root writes its output with a 'simple' pattern where it should have a 'complex' one). Apparently, the last "pattern" found in the config file is used for every 'logger' used with "console". On the contrary, the debug level works well.
with toml file :
outputs
The text was updated successfully, but these errors were encountered: