Fully Polished the loggin system

This commit is contained in:
Anonymous275
2020-02-03 21:52:11 +02:00
parent 60a0d13e63
commit 54319f7cdd
4 changed files with 72 additions and 48 deletions

View File

@@ -2,7 +2,6 @@
// Created by jojos38 on 28.01.2020.
//
#ifndef LOGGER_H
#define LOGGER_H
#include <iostream>
@@ -10,32 +9,10 @@
#include <sstream>
#include <string.h>
using namespace std;
extern int loggerlevel;
stringstream getDate();
void setLoggerLevel(char level_string[]);
template<typename T>
void info(const T& toPrint) {
if (loggerlevel <= 2)
cout << getDate().str() << "[INFO] " << toPrint << endl;
}
template<typename T>
void error(const T& toPrint) {
if (loggerlevel <= 4)
cout << getDate().str() "[ERRO] " << toPrint << endl;
}
template<typename T>
void warn(const T& toPrint) {
if (loggerlevel <= 3)
cout << getDate().str() << "[WARN] " << toPrint << endl;
}
template<typename T>
void debug(const T& toPrint) {
if (loggerlevel <= 1)
cout << getDate().str() << "[DBUG] " << toPrint << endl;
}
#endif // LOGGER_H
void info(basic_string<char> toPrint);
void warn(basic_string<char> toPrint);
void error(basic_string<char> toPrint);
void debug(basic_string<char> toPrint);