added date/time info when logging to a local file
authorerickson <erickson@9efc2488-bf62-4759-914b-345cdb29e865>
Sun, 18 May 2008 22:17:59 +0000 (22:17 +0000)
committererickson <erickson@9efc2488-bf62-4759-914b-345cdb29e865>
Sun, 18 May 2008 22:17:59 +0000 (22:17 +0000)
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1327 9efc2488-bf62-4759-914b-345cdb29e865

src/python/osrf/log.py

index 273e0fe..b3d57d0 100644 (file)
@@ -148,6 +148,8 @@ def __log_file(msg):
 
     global LOG_TYPE
 
 
     global LOG_TYPE
 
+    timestamp = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime())
+
     logfile = None
     try:
         logfile = open(LOG_FILE, 'a')
     logfile = None
     try:
         logfile = open(LOG_FILE, 'a')
@@ -157,7 +159,7 @@ def __log_file(msg):
         return
     try:
         LOG_SEMAPHORE.acquire()
         return
     try:
         LOG_SEMAPHORE.acquire()
-        logfile.write("%s\n" % msg)
+        logfile.write("%s %s\n" % (timestamp, msg))
     finally:
         LOG_SEMAPHORE.release()
         
     finally:
         LOG_SEMAPHORE.release()