encfs/vendor/github.com/muflihun/easyloggingpp/samples/STL/different-output.cpp
Valient Gough 5f0806c5cc Add "easylogging" from "https://github.com/muflihun/easyloggingpp@master"
git-vendor-name: easylogging
git-vendor-dir: vendor/github.com/muflihun/easyloggingpp
git-vendor-repository: https://github.com/muflihun/easyloggingpp
git-vendor-ref: master
2017-08-05 23:23:41 -07:00

32 lines
774 B
C++

//
// different-output.cpp
// v1.0
//
// Multiple loggers to have different output for file and console
//
#include "easylogging++.h"
INITIALIZE_EASYLOGGINGPP
#define MY_CUSTOM_LOGGER(LEVEL) CLOG(LEVEL, "default", "fileLogger")
int main() {
el::Configurations fileConf("../file.conf");
el::Configurations consoleConf("../console.conf");
el::Loggers::addFlag(el::LoggingFlag::MultiLoggerSupport); // Enables support for multiple loggers
el::Logger* fileLogger = el::Loggers::getLogger("fileLogger"); // Register new logger
el::Loggers::reconfigureLogger("default", consoleConf);
el::Loggers::reconfigureLogger(fileLogger, fileConf);
MY_CUSTOM_LOGGER(INFO) << "This is how we do it.";
return 0;
}