Browse Source

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

Reviewed-on: #4
pull/5/head
Oliver 2 years ago
parent
commit
4e4e85fe35
  1. 7
      Log.cpp

7
Log.cpp

@ -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];
}

Loading…
Cancel
Save