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