Add logger for feed

This commit is contained in:
cuom1999 2022-04-16 16:05:55 -05:00
parent 6797a8523b
commit 4d9d1f206a
3 changed files with 44 additions and 8 deletions

12
dmoj/decorators.py Normal file
View 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