diff options
author | morpheus65535 <[email protected]> | 2023-12-26 23:54:35 -0500 |
---|---|---|
committer | morpheus65535 <[email protected]> | 2023-12-26 23:54:35 -0500 |
commit | 163a7834d25a8653cd24ed12f28d152f40b6f9af (patch) | |
tree | 609c5b3305fdf681f30b27927a0c8e4bb197a078 | |
parent | 5739b9ad08b6c0c7eef14aad21863c8a08a88852 (diff) | |
parent | 9e75acd5493791879a3037a77c89ccddcb3844f4 (diff) | |
download | bazarr-163a7834d25a8653cd24ed12f28d152f40b6f9af.tar.gz bazarr-163a7834d25a8653cd24ed12f28d152f40b6f9af.zip |
Merge remote-tracking branch 'origin/development' into developmentv1.4.1-beta.8
-rw-r--r-- | bazarr/app/logger.py | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/bazarr/app/logger.py b/bazarr/app/logger.py index abf832aa9..b2a3eeffd 100644 --- a/bazarr/app/logger.py +++ b/bazarr/app/logger.py @@ -55,6 +55,36 @@ class NoExceptionFormatter(logging.Formatter): def formatException(self, record): return '' + +class UnwantedWaitressMessageFilter(logging.Filter): + def filter(self, record): + if settings.general.debug == True: + # no filtering in debug mode + return True + + unwantedMessages = [ + "Exception while serving /api/socket.io/", + ['Session is disconnected', 'Session not found' ], + + "Exception while serving /api/socket.io/", + ["'Session is disconnected'", "'Session not found'" ], + + "Exception while serving /api/socket.io/", + ['"Session is disconnected"', '"Session not found"' ] + ] + + wanted = True + listLength = len(unwantedMessages) + for i in range(0, listLength, 2): + if record.msg == unwantedMessages[i]: + exceptionTuple = record.exc_info + if exceptionTuple != None: + if str(exceptionTuple[1]) in unwantedMessages[i+1]: + wanted = False + break + + return wanted + def configure_logging(debug=False): warnings.simplefilter('ignore', category=ResourceWarning) @@ -129,6 +159,7 @@ def configure_logging(debug=False): logging.getLogger("ga4mp.ga4mp").setLevel(logging.ERROR) logging.getLogger("waitress").setLevel(logging.ERROR) + logging.getLogger("waitress").addFilter(UnwantedWaitressMessageFilter()) logging.getLogger("knowit").setLevel(logging.CRITICAL) logging.getLogger("enzyme").setLevel(logging.CRITICAL) logging.getLogger("guessit").setLevel(logging.WARNING) |