mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 16:34:53 +01:00
handle missing directory
This commit is contained in:
parent
7ad9e1bd5b
commit
bcf75bf37e
24 changed files with 443 additions and 105 deletions
|
|
@ -379,3 +379,22 @@ class PypeLogger:
|
|||
_mongo_logging = False
|
||||
|
||||
return logger
|
||||
|
||||
|
||||
def timeit(method):
|
||||
""" Decorator to print how much time function took.
|
||||
For debugging.
|
||||
Depends on presence of 'log' object
|
||||
"""
|
||||
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)
|
||||
else:
|
||||
log.debug('%r %2.2f ms' % (method.__name__, (te - ts) * 1000))
|
||||
print('%r %2.2f ms' % (method.__name__, (te - ts) * 1000))
|
||||
return result
|
||||
return timed
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue