summaryrefslogtreecommitdiff
path: root/src/logging.py
diff options
context:
space:
mode:
authorlouiz@4325f9fc-e183-4c21-96ce-0ab188b42d13 <louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13>2010-01-26 17:10:37 +0000
committerlouiz@4325f9fc-e183-4c21-96ce-0ab188b42d13 <louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13>2010-01-26 17:10:37 +0000
commit865ab0316a53a32c9caac842bbd54d233cdd2665 (patch)
tree7901dd80922ed8717eec4178cab97fba3b3daf74 /src/logging.py
parentb0b4dd1f0840def1352e34da8528af5e53696112 (diff)
downloadpoezio-865ab0316a53a32c9caac842bbd54d233cdd2665.tar.gz
poezio-865ab0316a53a32c9caac842bbd54d233cdd2665.tar.bz2
poezio-865ab0316a53a32c9caac842bbd54d233cdd2665.tar.xz
poezio-865ab0316a53a32c9caac842bbd54d233cdd2665.zip
nettoyage
Diffstat (limited to 'src/logging.py')
-rw-r--r--src/logging.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/logging.py b/src/logging.py
index b0b8b1aa..4bbedb9d 100644
--- a/src/logging.py
+++ b/src/logging.py
@@ -19,6 +19,7 @@
from config import config
import sys
+from datetime import datetime
class Logger(object):
"""
@@ -29,17 +30,16 @@ class Logger(object):
self.logfile = config.get('logfile')
def warning(self, msg):
- # change me
- # add timestamp and stuff like that, it's cool
- print 'Warning/error ' + msg
if self.logfile:
fd = open(self.logfile, 'a')
- fd.write(msg+'\n')
+ fd.write(datetime.now().strftime("%H:%M:%S") + ' Warning [' + msg + ']')
fd.close()
def error(self, msg):
- # change me too
- self.warning(msg)
+ if self.logfile:
+ fd = open(self.logfile, 'a')
+ fd.write(datetime.now().strftime("%H:%M:%S") + ' Error [' + msg + ']')
+ fd.close()
sys.exit(-1)
-log = Logger()
+logger = Logger()