Skip to content

Instantly share code, notes, and snippets.

@oliora
Last active August 29, 2015 14:13
Show Gist options
  • Save oliora/f8740d404c8670d24932 to your computer and use it in GitHub Desktop.
Save oliora/f8740d404c8670d24932 to your computer and use it in GitHub Desktop.
Simple Global Logger
#include "logger.h"
Logger Logger::instance_;
void Logger::log()
{
//...
}
#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