src/Logger.cc
author Tero Marttila <terom@fixme.fi>
Wed, 21 Jan 2009 23:07:22 +0200
branchnew_graphics
changeset 412 721c60072091
parent 365 65295dfbbf64
child 418 194bc810a570
permissions -rw-r--r--
new graphics code compiles... no, it doesn't work yet

#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
}