Add logger for feed
This commit is contained in:
parent
6797a8523b
commit
4d9d1f206a
3 changed files with 44 additions and 8 deletions
12
dmoj/decorators.py
Normal file
12
dmoj/decorators.py
Normal file
|
@ -0,0 +1,12 @@
|
|||
import time
|
||||
|
||||
def timeit(method):
|
||||
def timed(*args, **kw):
|
||||
ts = time.time()
|
||||
result = method(*args, **kw)
|
||||
te = time.time()
|
||||
if 'log_time' in kw:
|
||||
name = kw.get('log_name', method.__name__.upper())
|
||||
kw['log_time'][name] = int((te - ts) * 1000)
|
||||
return result
|
||||
return timed
|
Loading…
Add table
Add a link
Reference in a new issue