Skip to content

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

@koudis

Description

@koudis

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});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions