From 870a90c6a7383dd7dab61ea6b16f8a30cfeba44e Mon Sep 17 00:00:00 2001 From: Bob Polis Date: Thu, 3 Aug 2023 10:58:03 +0200 Subject: [PATCH] Removed comment header, timestamp shows microsecs --- src/logger.cpp | 11 +---------- src/logger.hpp | 8 -------- 2 files changed, 1 insertion(+), 18 deletions(-) diff --git a/src/logger.cpp b/src/logger.cpp index 1f3dfdf..c015c06 100644 --- a/src/logger.cpp +++ b/src/logger.cpp @@ -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 #include @@ -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(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) << "] "; diff --git a/src/logger.hpp b/src/logger.hpp index f048f63..079ef35 100644 --- a/src/logger.hpp +++ b/src/logger.hpp @@ -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_