mirror of
https://github.com/vgough/encfs.git
synced 2024-12-22 06:30:48 +01:00
32 lines
774 B
C++
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;
|
||
|
}
|