[Libreoffice-commits] online.git: common/Log.cpp

Ashod Nakashian ashod.nakashian at collabora.co.uk
Mon Jan 23 04:33:37 UTC 2017


 common/Log.cpp |   16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)

New commits:
commit b9c900d4599a4cb5073738884c32f700ce681e21
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date:   Tue Jan 17 18:30:58 2017 -0500

    wsd: format the time directly in the log prefix
    
    Change-Id: I6ad5faf8fdfa16831863bf4b8fa0568e88d0d0f8
    Reviewed-on: https://gerrit.libreoffice.org/33416
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
    Tested-by: Ashod Nakashian <ashnakash at gmail.com>

diff --git a/common/Log.cpp b/common/Log.cpp
index 8d020fb..e201dbf 100644
--- a/common/Log.cpp
+++ b/common/Log.cpp
@@ -78,11 +78,6 @@ namespace Log
 
     static void getPrefix(char *buffer, const char* level)
     {
-        // FIXME: If running under systemd it is redundant to output timestamps, as those will be
-        // attached to messages that the systemd journalling mechanism picks up anyway, won't they?
-
-        std::string time = DateTimeFormatter::format(Poco::Timestamp(), "%H:%M:%s");
-
         char procName[32]; // we really need only 16
         if (prctl(PR_GET_NAME, reinterpret_cast<unsigned long>(procName), 0, 0, 0) != 0)
         {
@@ -92,9 +87,11 @@ namespace Log
         const char* appName = (Source.inited ? Source.id.c_str() : "<shutdown>");
         assert(strlen(appName) + 32 + 28 < 1024 - 1);
 
-        snprintf(buffer, 4095, "%s-%.04lu %s [ %s ] %s  ", appName,
+        Poco::DateTime time;
+        snprintf(buffer, 1023, "%s-%.04lu %.2u:%.2u:%.2u.%.6u [ %s ] %s  ", appName,
                  syscall(SYS_gettid),
-                 time.c_str(),
+                 time.hour(), time.minute(), time.second(),
+                 time.millisecond() * 1000 + time.microsecond(),
                  procName, level);
     }
 
@@ -159,11 +156,6 @@ namespace Log
             oss << " Local time: " << buf << ".";
         }
 
-        if (strftime(buf, sizeof(buf), "%a %F %T%z", std::gmtime(&t)) > 0)
-        {
-            oss << " UTC time: " << buf << ".";
-        }
-
         oss <<  " Log level is [" << logger.getLevel() << "].";
         info(oss.str());
     }


More information about the Libreoffice-commits mailing list