Refactoring: split logging code into individual files

This commit is contained in:
Daniel Wolf
2017-09-10 22:17:16 +02:00
parent 24e8da4474
commit 4c0d706857
14 changed files with 310 additions and 213 deletions

View File

@@ -0,0 +1,18 @@
#include "formatters.h"
#include <format.h>
#include "Entry.h"
#include "tools.h"
using std::string;
namespace logging {
string SimpleConsoleFormatter::format(const Entry& entry) {
return fmt::format("[{0}] {1}", entry.level, entry.message);
}
string SimpleFileFormatter::format(const Entry& entry) {
return fmt::format("[{0}] {1} {2}", formatTime(entry.timestamp, "%F %H:%M:%S"), entry.threadCounter, consoleFormatter.format(entry));
}
}