diff options
author | Will Holland <william.holland@codethink.co.uk> | 2015-09-22 15:14:50 +0100 |
---|---|---|
committer | Will Holland <william.holland@codethink.co.uk> | 2015-09-22 15:14:50 +0100 |
commit | 75303a157c460c98dd0fe66c9a1bf315c9ffb45c (patch) | |
tree | 9ff0899cef0b34e5aeea812db30fd804d12fea10 /common.py | |
download | ciatlib-75303a157c460c98dd0fe66c9a1bf315c9ffb45c.tar.gz |
Initial Commit
Diffstat (limited to 'common.py')
-rw-r--r-- | common.py | 10 |
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() |