diff options
author | LaG1924 <12997935+LaG1924@users.noreply.github.com> | 2017-05-28 16:16:05 +0200 |
---|---|---|
committer | LaG1924 <12997935+LaG1924@users.noreply.github.com> | 2017-05-28 16:16:05 +0200 |
commit | d93c2073896e63aca5a859fe7182ba24dbe84cd3 (patch) | |
tree | 6144aaf7e01854fe245011ca4f4735974366febb /src/main.cpp | |
parent | 2017-05-26 (diff) | |
download | AltCraft-d93c2073896e63aca5a859fe7182ba24dbe84cd3.tar AltCraft-d93c2073896e63aca5a859fe7182ba24dbe84cd3.tar.gz AltCraft-d93c2073896e63aca5a859fe7182ba24dbe84cd3.tar.bz2 AltCraft-d93c2073896e63aca5a859fe7182ba24dbe84cd3.tar.lz AltCraft-d93c2073896e63aca5a859fe7182ba24dbe84cd3.tar.xz AltCraft-d93c2073896e63aca5a859fe7182ba24dbe84cd3.tar.zst AltCraft-d93c2073896e63aca5a859fe7182ba24dbe84cd3.zip |
Diffstat (limited to 'src/main.cpp')
-rw-r--r-- | src/main.cpp | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/main.cpp b/src/main.cpp index 53f90eb..de2c9d8 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,15 +1,24 @@ #include "core/Core.hpp" -#define ELPP_THREAD_SAFE -#define ELPP_FEATURE_CRASH_LOG -#define ELPP_DISABLE_LOGS +const char *getTimeSinceProgramStart(void) { + static auto initialTime = std::chrono::steady_clock().now(); + auto now = std::chrono::steady_clock().now(); + std::chrono::duration<double> seconds = now-initialTime; + static char buffer[30]; + sprintf(buffer, "%.2f", seconds.count()); + return buffer; +} + INITIALIZE_EASYLOGGINGPP int main() { el::Configurations loggerConfiguration; - std::string format = "[%level]{%fbase}: %msg"; + el::Helpers::installCustomFormatSpecifier( + el::CustomFormatSpecifier("%startTime", std::bind(getTimeSinceProgramStart))); + std::string format = "[%startTime][%level][%fbase]: %msg"; loggerConfiguration.set(el::Level::Info, el::ConfigurationType::Format, format); loggerConfiguration.set(el::Level::Error, el::ConfigurationType::Format, format); + loggerConfiguration.set(el::Level::Fatal, el::ConfigurationType::Format, format); el::Loggers::reconfigureAllLoggers(loggerConfiguration); el::Loggers::addFlag(el::LoggingFlag::ColoredTerminalOutput); LOG(INFO) << "Logger is configured"; |