-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
spdlog::initialize_logger undesired effect on patterns #2648
Comments
The description of spdlog/include/spdlog/spdlog.h Lines 39 to 47 in da14258
If you are calling |
@tt4g Since you normally create |
If you think there is demand, please open a PR to add an API that allows only log levels to be set. spdlog/include/spdlog/details/registry-inl.h Lines 70 to 73 in 7d805c2
|
Already created a PR #2649 . I hope I have not made any mistakes there. |
My PR already merged. Now everyone can use |
Hi all
I have a small code with 1 logger and 2 sinkers with different pattern on sinkers:
now if you log anything with
logger
like this:You will see default pattern on output of both sinkers. Why? Because
spdlog::initialize_logger
applies pattern on loggers(which is default) and these patterns will be applied to sinkers overriding their patterns. I usedspdlog::initialize_logger
only in order to applySPDLOG_LEVEL
values from command line, but this undesired behavior is very bad. I think I have a workaround by setting patterns afterspdlog::initialize_logger(logger)
, but I don't think this is a desired approach.The text was updated successfully, but these errors were encountered: