Removed comment header, timestamp shows microsecs
This commit is contained in:
parent
2671859cc9
commit
870a90c6a7
@ -1,11 +1,3 @@
|
||||
//
|
||||
// logger.cpp
|
||||
// libsclogging
|
||||
//
|
||||
// Created by Bob Polis at 2020-04-29
|
||||
// Copyright (c) 2020 SwiftCoder. All rights reserved.
|
||||
//
|
||||
|
||||
#include "logger.hpp"
|
||||
#include <unistd.h>
|
||||
#include <sys/time.h>
|
||||
@ -33,13 +25,12 @@ void logger::write_prefix(loglevel level, const char* file, int line, const char
|
||||
// retrieve accurate time for milliseconds display
|
||||
struct timeval secs;
|
||||
(void)::gettimeofday(&secs, nullptr);
|
||||
int ms = static_cast<int>(std::roundf(secs.tv_usec / 1000.0)) % 1000;
|
||||
|
||||
// create a date/time stamp
|
||||
char dtstamp[20];
|
||||
std::strftime(dtstamp, 20, "%F %T", std::localtime(&secs.tv_sec));
|
||||
|
||||
std::cerr << dtstamp << "." << std::setfill('0') << std::setw(3) << ms << " ";
|
||||
std::cerr << dtstamp << "." << std::setfill('0') << std::setw(6) << secs.tv_usec << " ";
|
||||
std::cerr << _name << "[" << ::getpid() << "] ";
|
||||
std::cerr << file << ":" << line << " " << func << "() ";
|
||||
std::cerr << '[' << loglevel_desc(level) << "] ";
|
||||
|
@ -1,11 +1,3 @@
|
||||
//
|
||||
// logger.hpp
|
||||
// libsclogging
|
||||
//
|
||||
// Created by Bob Polis at 2020-04-29
|
||||
// Copyright (c) 2020 SwiftCoder. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef _logger_H_
|
||||
#define _logger_H_
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user