encfs/vendor/github.com/muflihun/easyloggingpp/samples/STL/multiple-loggers.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
821 B
C++

//
// This file is part of Easylogging++ samples
// Very basic sample - log using multiple loggers
//
// Revision 1.0
// @author mkhan3189
//
#include "easylogging++.h"
INITIALIZE_EASYLOGGINGPP
int main(void) {
el::Loggers::addFlag(el::LoggingFlag::MultiLoggerSupport); // Enables support for multiple loggers
el::Loggers::getLogger("network"); // Register 'network' logger
CLOG(INFO, "default", "network") << "My first log message that writes with network and default loggers";
// Another way of doing this may be
#define _LOGGER "default", "network"
CLOG(INFO, _LOGGER) << "This is done by _LOGGER";
// More practical way of doing this
#define NETWORK_LOG(LEVEL) CLOG(LEVEL, _LOGGER)
NETWORK_LOG(INFO) << "This is achieved by NETWORK_LOG macro";
return 0;
}