Merge pull request 'get Time is now more readable' (#4) from MrBesen/Log:master into master

Reviewed-on: https://git.okaestne.de/okaestne/Log/pulls/4
This commit is contained in:
Oliver 2020-12-14 19:41:17 +01:00
commit 4e4e85fe35
1 changed files with 3 additions and 4 deletions

View File

@ -29,7 +29,7 @@ public:
#if LOG_USEMUTEX == 1
std::unique_lock<std::mutex> lock(ostreamLock);
#endif
std::ostream* os = getOs(lvl);
if (os) {
*os << sbuf << std::endl;
@ -162,11 +162,10 @@ void Entry::addMetadataHeader() {
"[NOTE ] ", "[INFO ] ", "[DEBUG] ", "[TRACE] "};
// get current date/time
auto now = std::chrono::system_clock::now();
std::time_t now_c = std::chrono::system_clock::to_time_t(now);
std::time_t now = std::time(NULL);
// datetime
ss << "[" << std::put_time(std::localtime(&now_c), "%F %T") << "]";
ss << "[" << std::put_time(std::localtime(&now), "%F %T") << "]";
// log level
ss << LevelTag[lvl];
}