Skip to content
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

Logger FileSink doesn't correctly work with multiple loggers #10

Open
koudis opened this issue Sep 1, 2024 · 0 comments
Open

Logger FileSink doesn't correctly work with multiple loggers #10

koudis opened this issue Sep 1, 2024 · 0 comments

Comments

@koudis
Copy link
Member

koudis commented Sep 1, 2024

Using two separate loggers to log into a single file causes the resulting logs to not be in the correct order.

Code used to initialize loggers:

#include <bringauto/logging/Logger.hpp>
#include <bringauto/logging/FileSink.hpp>

namespace log = bringauto::logging;

constexpr log::LoggerId logId1 = {.id = "id1"};
constexpr log::LoggerId logId2 = {.id = "id2"};

using Logger1 = log::Logger<logId1, log::LoggerImpl>;
using Logger2 = log::Logger<logId2, log::LoggerImpl>;

log::FileSink::Params fsParams = {"./", "log_file.log"};

Logger1::addSink<log::FileSink>(fsParams);
Logger1::init({"Logger1", log::LoggerVerbosity::Debug});

Logger2::addSink<log::FileSink>(fsParams);
Logger2::init({"Logger2", log::LoggerVerbosity::Debug});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant