You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
#include "logger.h"
|
|
|
|
|
|
|
|
#include <iostream>
|
|
|
|
#include <cstdlib>
|
|
|
|
|
|
|
|
void log(LogLevel level, const std::string& message, std::string prettyFunction)
|
|
|
|
{
|
|
|
|
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 << "] ";
|
|
|
|
}
|
|
|
|
|
|
|
|
std::cout << message << std::endl;
|
|
|
|
|
|
|
|
if(level == LogFatal)
|
|
|
|
exit(-1);
|
|
|
|
}
|