Minor Log.cpp update.
This commit is contained in:
parent
947eef21e2
commit
bf1db47043
19
Log.cpp
19
Log.cpp
@ -18,13 +18,18 @@ namespace coreutils {
|
||||
Log::Log(int level) {
|
||||
|
||||
output = true;
|
||||
|
||||
std::stringstream temp;
|
||||
struct timespec timex;
|
||||
clock_gettime(CLOCK_REALTIME, &timex);
|
||||
temp << timex.tv_sec << "." << std::setfill('0') << std::setw(9) << timex.tv_nsec;
|
||||
|
||||
// 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);
|
||||
|
||||
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 << timeOut;
|
||||
*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();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user