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

IAppender add MaxSeverity to filter log #115

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

redfox1999
Copy link

Appender add MaxServerity to filter log

@SergiusTheBest
Copy link
Owner

SergiusTheBest commented Jan 17, 2019

Hi @redfox1999 ,

Thank you for the pull request! However IAppender doesn't need severity filter as logger already has one. So you basically need to create several loggers and link them together:

enum
{
    FileSink = 1,
    ConsoleSink = 2,
};

static plog::RollingFileAppender<plog::CsvFormatter> fileAppender("MultiAppender.csv", 8000, 3); // Create the 1st appender.
static plog::ColorConsoleAppender<plog::TxtFormatter> consoleAppender; // Create the 2nd appender.

plog::init<FileSink>(plog::debug, &fileAppender);
plog::init<ConsoleSink>(plog::warning, &consoleAppender);
plog::init(plog::debug, plog::get<FileSink>()).addAppender(plog::get<ConsoleSink>());

LOGD << "Hello!";

plog::get<FileSink>()->setMaxSeverity(plog::info);

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

Successfully merging this pull request may close these issues.

2 participants