src/Logger.cc
author Tero Marttila <terom@fixme.fi>
Thu, 22 Jan 2009 01:53:05 +0200
branchnew_graphics
changeset 417 c503e0c6a740
parent 412 721c60072091
child 418 194bc810a570
permissions -rw-r--r--
support for building without Network/Graphics, although the disable-graphics case is kind of hackish still

#include "Logger.hh"

Logger::Logger (std::ostream &stream, enum LogLevel level, const char *module) : 
    stream(stream), level(level), module(module) 
{
    const char *l;

    switch (level) {
        case FATAL: l = "FATAL"; break;
        case ERROR: l = "ERROR"; break;
        case WARN: l = "WARN"; break;
        case INFO: l = "INFO"; break;
        case DEBUG: l = "DEBUG"; break;
        default: l = "???"; break;
    };

#ifndef NDEBUG    
    stream << l << " [" << module << "] ";
#endif
}

Logger::~Logger (void) {
#ifndef NDEBUG    
    stream << std::endl;
#endif
}