mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-04-30 18:47: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):
|
def decorator(func):
|
||||||
@wraps(func)
|
@wraps(func)
|
||||||
def wrapper(*args, **kwargs):
|
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_stdout = sys.stdout
|
||||||
old_stderr = sys.stderr
|
old_stderr = sys.stderr
|
||||||
@ -150,11 +151,13 @@ def redirect_stdout_to_logpipe(log_name: str, level: int):
|
|||||||
sys.stderr = current_log_pipe
|
sys.stderr = current_log_pipe
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
print()
|
||||||
result = func(*args, **kwargs)
|
result = func(*args, **kwargs)
|
||||||
finally:
|
finally:
|
||||||
sys.stdout = old_stdout
|
sys.stdout = old_stdout
|
||||||
sys.stderr = old_stderr
|
sys.stderr = old_stderr
|
||||||
current_log_pipe.dump()
|
current_log_pipe.dump()
|
||||||
|
current_log_pipe.close()
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user