DynuIPRefresher/src/Logger.cpp
2020-04-30 12:16:29 +02:00

54 lines
1.0 KiB
C++

//
// Created by lukas on 26.10.19.
//
#include <sstream>
#include <iostream>
#include "Logger.h"
const int Logger::Warning = 1;
const int Logger::Debug = 2;
const int Logger::Message = 3;
const int Logger::Error = 4;
void Logger::debug(const std::string message) {
log(message, Logger::Debug);
}
void Logger::message(const std::string message) {
log(message, Logger::Message);
}
void Logger::warning(const std::string message) {
log(message, Logger::Warning);
}
void Logger::error(const std::string message) {
log(message, Logger::Error);
}
void Logger::log(const std::string &message, int level) {
std::stringstream out;
out << "[";
switch (level) {
case Debug:
out << "DEBUG";
break;
case Message:
out << "MESSAGE";
break;
case Warning:
out << "WARNING";
break;
case Error:
out << "ERROR";
break;
}
out << "] ";
out << message;
std::cout << out.str() << std::endl;
}