-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make logging code self-contained (#13785)
* Make logging code self-contained. Rewrite logging code to use python's builting QueueListener, effectively moving the logging process into a thread of the Frigate app. Also, wrap this behaviour in a easy-to-use context manager to encourage some consistency. * Fixed typing errors * Remove todo note from log filter Co-authored-by: Nicolas Mowen <nickmowen213@gmail.com> * Do not access log record's msg directly * Clear all root handlers before starting app --------- Co-authored-by: Nicolas Mowen <nickmowen213@gmail.com>
- Loading branch information
Showing
4 changed files
with
65 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,28 @@ | ||
import faulthandler | ||
import logging | ||
import threading | ||
|
||
from flask import cli | ||
|
||
from frigate.app import FrigateApp | ||
|
||
faulthandler.enable() | ||
|
||
threading.current_thread().name = "frigate" | ||
def main() -> None: | ||
faulthandler.enable() | ||
|
||
cli.show_server_banner = lambda *x: None | ||
# Clear all existing handlers. | ||
logging.basicConfig( | ||
level=logging.INFO, | ||
handlers=[], | ||
force=True, | ||
) | ||
|
||
if __name__ == "__main__": | ||
frigate_app = FrigateApp() | ||
threading.current_thread().name = "frigate" | ||
cli.show_server_banner = lambda *x: None | ||
|
||
# Run the main application. | ||
FrigateApp().start() | ||
|
||
frigate_app.start() | ||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters