encfs/vendor/github.com/muflihun/easyloggingpp/samples/STL/loggable.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

33 lines
592 B
C++

//
// This file is part of Easylogging++ samples
//
// Usage sample of el::Loggable to make class log-friendly
//
// Revision 1.1
// @author mkhan3189
//
#include "easylogging++.h"
INITIALIZE_EASYLOGGINGPP
class MyClass : public el::Loggable {
public:
MyClass(const std::string& name) : m_name(name) {}
virtual inline void log(el::base::type::ostream_t& os) const {
os << m_name.c_str();
}
private:
std::string m_name;
};
int main(void) {
MyClass c("c");
MyClass c2("c2");
LOG(INFO) << "I am " << c << "; and I am " << c2;
return 0;
}