introduce timestamp to logs
paulfantom committed
Aug 14, 2016 at 16:11 UTC
21cab4a555b7f58ca0b826403d0c0c2b6f753db4
1 file changed
+3
-2
python.d/python_modules/msg.py
+3
-2
@@ -2,7 +2,7 @@
2
# Description: logging for netdata python.d modules
3
4
import sys
5
-from time import time
5
+from time import time, strftime
6
7
DEBUG_FLAG = False
8
PROGRAM = ""
@@ -24,7 +24,8 @@ def log_msg(msg_type, *args):
24
LOG_COUNTER -= 1
25
now = time()
26
if LOG_COUNTER >= 0:
27
- msg = "%s %s: %s" % (PROGRAM, str(msg_type), " ".join(args))
27
+ timestamp = strftime('%y-%m-%d %X')
28
+ msg = "%s: %s %s: %s" % (timestamp, PROGRAM, str(msg_type), " ".join(args))
29
WRITE(msg + "\n")
30
FLUSH()
31