Last active
August 29, 2015 14:13
-
-
Save oliora/f8740d404c8670d24932 to your computer and use it in GitHub Desktop.
Simple Global Logger
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "logger.h" | |
Logger Logger::instance_; | |
void Logger::log() | |
{ | |
//... | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma once | |
class Logger | |
{ | |
public: | |
static Logger& instance() | |
{ | |
return instance_; | |
} | |
void log(const char *msg); | |
// void configure(...); etc | |
private: | |
Logger(); | |
static Logger instance_; | |
}; | |
#define LOG(msg) Logger::instance().log(msg) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment