Minor Log.cpp update.

This commit is contained in:
Brad Arant 2020-04-13 09:39:01 -07:00
parent 947eef21e2
commit bf1db47043
2 changed files with 13 additions and 8 deletions

17
Log.cpp
View File

@ -19,12 +19,17 @@ namespace coreutils {
output = true;
auto clock = std::chrono::system_clock::now();
time_t theTime = std::chrono::system_clock::to_time_t(clock);
std::string timeOut = std::string(ctime(&theTime));
timeOut = timeOut.substr(0, timeOut.length() - 1);
std::stringstream temp;
struct timespec timex;
clock_gettime(CLOCK_REALTIME, &timex);
temp << timex.tv_sec << "." << std::setfill('0') << std::setw(9) << timex.tv_nsec;
*this << timeOut;
// auto clock = std::chrono::system_clock::now();
// time_t theTime = std::chrono::system_clock::to_time_t(clock);
// std::string timeOut = std::string(ctime(&theTime));
// timeOut = timeOut.substr(0, timeOut.length() - 1);
*this << temp.str();
*this << " ";
switch(level) {
@ -63,7 +68,7 @@ namespace coreutils {
if(output) {
std::stringstream out;
out << seq << "." << this->str() << std::endl;;
out << this->str() << std::endl;;
mtx.lock();

View File

@ -33,6 +33,6 @@
#include <openssl/rand.h>
#include <openssl/err.h>
#include <dirent.h>
#include <iomanip>