summaryrefslogtreecommitdiff
path: root/common.py
diff options
context:
space:
mode:
authorWill Holland <william.holland@codethink.co.uk>2015-09-22 15:14:50 +0100
committerWill Holland <william.holland@codethink.co.uk>2015-09-22 15:14:50 +0100
commit75303a157c460c98dd0fe66c9a1bf315c9ffb45c (patch)
tree9ff0899cef0b34e5aeea812db30fd804d12fea10 /common.py
downloadciatlib-75303a157c460c98dd0fe66c9a1bf315c9ffb45c.tar.gz
Initial Commit
Diffstat (limited to 'common.py')
-rw-r--r--common.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/common.py b/common.py
new file mode 100644
index 0000000..7a70a8b
--- /dev/null
+++ b/common.py
@@ -0,0 +1,10 @@
+def log(logfile,component,msg):
+ ''' write message to log file with timestamp and script name '''
+ import datetime
+ _component = str(component)
+ _msg = str(msg)
+ dt = str(datetime.datetime.now()).split('.')[0]
+ to_log = "[%s][%s] %s" % (dt, _component, _msg)
+ log_file = open(LOGFILE,'a')
+ log_file.write('%s\n' % to_log)
+ log_file.close()