Replies: 2 comments 6 replies
-
auto rotating_file_sink = std::make_shared<spdlog::sinks::rotating_file_sink_mt>("./logs/gateway.log", 1048576 * 5, 3);
auto file_logger = std::make_shared<spdlog::logger>("module-1", rotating_file_sink);
spdlog::initialize_logger(file_logger);
auto file_logger2 = std::make_shared<spdlog::logger>("module-2", rotating_file_sink);
spdlog::initialize_logger(file_logger2); See Wiki: https://github.com/gabime/spdlog/wiki/4.-Sinks#available-sinks |
Beta Was this translation helpful? Give feedback.
4 replies
-
Right, this is the correct way for writing to same file from multiple loggers and @manushawijekoon’s example is not valid. Also, logger->clone() can be used. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Is this usage valid:
Basically both loggers point to the same file.
I tested this and it seem to work but wanted to check if this is a valid usage before going forward.
Beta Was this translation helpful? Give feedback.
All reactions