# Description: logging for netdata python.d modules
import sys
-from time import time
+from time import time, strftime
DEBUG_FLAG = False
PROGRAM = ""
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()
if NEXT_CHECK <= now:
NEXT_CHECK = now - (now % LOG_INTERVAL) + LOG_INTERVAL
if LOG_COUNTER < 0:
- msg = "Prevented %s log messages from displaying" % str(0 - LOG_COUNTER)
+ timestamp = strftime('%Y-%m-%d %X')
+ msg = "%s: python.d.plugin: Prevented %s log messages from displaying" % (timestamp, str(0 - LOG_COUNTER))
WRITE(msg + "\n")
FLUSH()