mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-04-27 17:17:40 +03:00
run logpipe
This commit is contained in:
parent
8bf0933be2
commit
9d115c1b3c
@ -142,7 +142,8 @@ def redirect_stdout_to_logpipe(log_name: str, level: int):
|
||||
def decorator(func):
|
||||
@wraps(func)
|
||||
def wrapper(*args, **kwargs):
|
||||
current_log_pipe = LogPipe(log_name, level)
|
||||
current_log_pipe = LogPipe(log_name, logging.ERROR)
|
||||
current_log_pipe.run()
|
||||
|
||||
old_stdout = sys.stdout
|
||||
old_stderr = sys.stderr
|
||||
@ -150,11 +151,13 @@ def redirect_stdout_to_logpipe(log_name: str, level: int):
|
||||
sys.stderr = current_log_pipe
|
||||
|
||||
try:
|
||||
print()
|
||||
result = func(*args, **kwargs)
|
||||
finally:
|
||||
sys.stdout = old_stdout
|
||||
sys.stderr = old_stderr
|
||||
current_log_pipe.dump()
|
||||
current_log_pipe.close()
|
||||
|
||||
return result
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user