1 """A very simple logger that tries to be concurrency-safe."""
9 LOG_FILE = '/var/log/nm'
12 """Write <msg> to the log file."""
14 fd = os.open(LOG_FILE, os.O_WRONLY | os.O_CREAT | os.O_APPEND, 0600)
15 if not msg.endswith('\n'): msg += '\n'
16 os.write(fd, '%s: %s' % (time.asctime(time.gmtime()), msg))
23 log('running command %s' % ' '.join(args))
24 try: subprocess.call(args)
28 """Log the traceback resulting from an exception."""
29 log(traceback.format_exc())