More documentation.
[nodemanager.git] / logger.py
index 3411df5..6999f31 100644 (file)
--- a/logger.py
+++ b/logger.py
@@ -1,4 +1,5 @@
-import fcntl
+"""A very simple logger that tries to be concurrency-safe."""
+
 import os
 import subprocess
 import time
@@ -9,10 +10,7 @@ from config import LOG_FILE
 
 def log(msg):
     """Write <msg> to the log file."""
-    # the next three lines ought to be an atomic operation but aren't
     fd = os.open(LOG_FILE, os.O_WRONLY | os.O_CREAT | os.O_APPEND, 0600)
-    flags = fcntl.fcntl(fd, fcntl.F_GETFD)
-    fcntl.fcntl(fd, fcntl.F_SETFD, flags | fcntl.FD_CLOEXEC)
     if not msg.endswith('\n'): msg += '\n'
     os.write(fd, '%s: %s' % (time.asctime(time.gmtime()), msg))
     os.close(fd)