encfs/vendor/github.com/muflihun/easyloggingpp/samples/STL/new-logger-registration-callback.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

39 lines
967 B
C++

//
// This file is part of Easylogging++ samples
// LoggerRegistrationCallback sample
//
// Revision 1.0
// @author mkhan3189
//
#include "easylogging++.h"
INITIALIZE_EASYLOGGINGPP
class Handler : public el::LoggerRegistrationCallback {
protected:
void handle(const el::Logger* logger) {
// Never log anything here
ELPP_COUT << "(Handler) Registered new logger " << logger->id() << std::endl;
}
};
class Handler2 : public el::LoggerRegistrationCallback {
protected:
void handle(const el::Logger* logger) {
ELPP_COUT << "(Handler2) Registered new logger " << logger->id() << std::endl;
}
};
int main(void) {
el::Loggers::installLoggerRegistrationCallback<Handler>("handler");
el::Loggers::installLoggerRegistrationCallback<Handler2>("handler2");
LOG(INFO) << "Now we will register three loggers";
el::Loggers::getLogger("logger1");
el::Loggers::getLogger("logger2");
el::Loggers::getLogger("logger3");
return 0;
}