Mercurial > templog
comparison web/log.py @ 288:95f704ce809d
start/end for debug
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Thu, 01 Feb 2018 23:49:48 +0800 |
parents | 61269311ed3d |
children | f7261dd970da |
comparison
equal
deleted
inserted
replaced
286:61269311ed3d | 288:95f704ce809d |
---|---|
219 def debug_file(mode='r'): | 219 def debug_file(mode='r'): |
220 return open('%s/debug.log' % config.DATA_PATH, mode) | 220 return open('%s/debug.log' % config.DATA_PATH, mode) |
221 | 221 |
222 def record_debug(params): | 222 def record_debug(params): |
223 f = debug_file('a+') | 223 f = debug_file('a+') |
224 f.write('===== %s =====\n' % time.strftime('%a, %d %b %Y %H:%M:%S')) | 224 f.write('===== start %s =====\n' % time.strftime('%a, %d %b %Y %H:%M:%S')) |
225 json.dump(params, f, sort_keys=True, indent=4) | 225 json.dump(params, f, sort_keys=True, indent=4) |
226 f.write('===== end %s =====\n' % time.strftime('%a, %d %b %Y %H:%M:%S')) | |
226 f.flush() | 227 f.flush() |
227 return f | 228 return f |
228 | 229 |
229 def tail_debug_log(): | 230 def tail_debug_log(): |
230 f = debug_file() | 231 f = debug_file() |