-
Hello people, I am using default_logger API (spdlog::info(...), etc.) in my whole project. The default_logger implements an async_logger with console and file sink. Now I want to add a TCP sink. However, the associated TCP server is not always reachable, so my other sinks are currently blocking for the timeout period for the TCP sink. To prevent this, I have spun off the TCP sink into its own async_logger, so that the sink is processed in its own thread. This meets my requirements so far. But I don't want to change the places where the default_logger API is used in the project and I want to have two loggers that are fed by the default_api. Is that possible? Am I following a completely wrong approach? I would be happy about any suggestions! Greetings |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
A possible solution is to have a custom sink that forwards the logs to 2 async loggers, each with its own dedicated thread pool (async tcp+async file/stdout). So the final setup would be 3 loggers:
The downside is some performance hit since the data needs to be duplicated to 2 queues. |
Beta Was this translation helpful? Give feedback.
-
I am facing below issue with spdlogger. Thanks in advance for help !! |
Beta Was this translation helpful? Give feedback.
A possible solution is to have a custom sink that forwards the logs to 2 async loggers, each with its own dedicated thread pool (async tcp+async file/stdout).
So the final setup would be 3 loggers:
The downside is some performance hit since the data needs to be duplicated to 2 queues.