]> arthur.barton.de Git - netdata.git/commitdiff
introduce timestamp to logs
authorpaulfantom <paulfantom@gmail.com>
Sun, 14 Aug 2016 14:11:32 +0000 (16:11 +0200)
committerpaulfantom <paulfantom@gmail.com>
Sun, 14 Aug 2016 14:11:32 +0000 (16:11 +0200)
python.d/python_modules/msg.py

index c1421605d90ed2f94d38cdafb1b8810a3b3a3a72..ef6d933480572bd7455188b489c8eb652e1f377b 100644 (file)
@@ -2,7 +2,7 @@
 # Description: logging for netdata python.d modules
 
 import sys
-from time import time
+from time import time, strftime
 
 DEBUG_FLAG = False
 PROGRAM = ""
@@ -24,7 +24,8 @@ def log_msg(msg_type, *args):
         LOG_COUNTER -= 1
     now = time()
     if LOG_COUNTER >= 0:
-        msg = "%s %s: %s" % (PROGRAM, str(msg_type), " ".join(args))
+        timestamp = strftime('%y-%m-%d %X')
+        msg = "%s: %s %s: %s" % (timestamp, PROGRAM, str(msg_type), " ".join(args))
         WRITE(msg + "\n")
         FLUSH()