1 # -*- coding: utf-8 -*-
2 # Description: logging for netdata python.d modules
13 WRITE = sys.stderr.write
14 FLUSH = sys.stderr.flush
17 def log_msg(msg_type, *args):
19 Print message on stderr.
27 msg = "%s %s: %s" % (PROGRAM, str(msg_type), " ".join(args))
33 NEXT_CHECK = now - (now % LOG_INTERVAL) + LOG_INTERVAL
35 msg = "Prevented %s log messages from displaying" % str(0 - LOG_COUNTER)
42 Print debug message on stderr.
47 log_msg("DEBUG", *args)
52 Print message on stderr.
54 log_msg("ERROR", *args)
59 Print message on stderr.
61 log_msg("INFO", *args)
66 Print message on stderr and exit.
68 log_msg("FATAL", *args)
69 # using sys.stdout causes IOError: Broken Pipe
71 # sys.stdout.write('DISABLE\n')