mirror of
https://github.com/vgough/encfs.git
synced 2025-01-21 13:18:36 +01:00
5f0806c5cc
git-vendor-name: easylogging git-vendor-dir: vendor/github.com/muflihun/easyloggingpp git-vendor-repository: https://github.com/muflihun/easyloggingpp git-vendor-ref: master
34 lines
874 B
C++
34 lines
874 B
C++
//
|
|
// This file is part of Easylogging++ samples
|
|
// Simple custom log builder
|
|
//
|
|
// Revision 1.0
|
|
// @author mkhan3189
|
|
//
|
|
|
|
#include "easylogging++.h"
|
|
|
|
INITIALIZE_EASYLOGGINGPP
|
|
|
|
/// @brief Not a very fast log builder but good enough for sample
|
|
class MyLogBuilder : public el::LogBuilder {
|
|
public:
|
|
std::string build(const el::LogMessage* logMessage, bool appendNewLine) const {
|
|
std::stringstream str;
|
|
str << logMessage->message();
|
|
if (appendNewLine) str << "\n";
|
|
return str.str().c_str();
|
|
}
|
|
};
|
|
|
|
int main(void) {
|
|
el::LogBuilderPtr myLogBuilder = el::LogBuilderPtr(new MyLogBuilder());
|
|
el::Loggers::getLogger("default")->setLogBuilder(myLogBuilder);
|
|
LOG(INFO) << "message from default logger";
|
|
|
|
el::Loggers::getLogger("new_logger");
|
|
CLOG(INFO, "new_logger") << "message from new_logger logger";
|
|
|
|
return 0;
|
|
}
|