1 # -*- coding: utf-8 -*-
2 # Description: logging for netdata python.d modules
10 def log_msg(msg_type, *args):
12 Print message on stderr.
15 msg = "%s %s: %s" % (PROGRAM, str(msg_type), " ".join(args))
17 sys.stderr.write(msg + "\n")
23 Print debug message on stderr.
28 log_msg("DEBUG", *args)
33 Print message on stderr.
35 log_msg("ERROR", *args)
40 Print message on stderr.
42 log_msg("INFO", *args)
47 Print message on stderr and exit.
49 log_msg("FATAL", *args)
50 # using sys.stdout causes IOError: Broken Pipe
52 # sys.stdout.write('DISABLE\n')