tibia-client/src/framework/util/logger.cpp

21 lines
605 B
C++
Raw Normal View History

2011-07-13 23:12:36 +02:00
#include "logger.h"
2011-04-06 21:46:58 +02:00
#include <iostream>
2011-04-07 10:45:58 +02:00
#include <cstdlib>
2011-07-17 02:13:53 +02:00
void log(LogLevel level, const std::string& message, std::string prettyFunction)
{
2011-07-17 02:13:53 +02:00
if(!prettyFunction.empty()) {
prettyFunction = prettyFunction.substr(0, prettyFunction.find_first_of('('));
if(prettyFunction.find_last_of(' ') != std::string::npos)
prettyFunction = prettyFunction.substr(prettyFunction.find_last_of(' ') + 1);
if(!prettyFunction.empty())
std::cout << "[" << prettyFunction << "] ";
}
2011-07-17 02:13:53 +02:00
std::cout << message << std::endl;
2011-07-13 23:12:36 +02:00
if(level == LogFatal)
exit(-1);
}