mirror of
https://github.com/denizsafak/abogen.git
synced 2026-09-20 11:40:57 +02:00
chore: suppress phonemizer word-count-mismatch warnings (normal behavior)
This commit is contained in:
@@ -29,6 +29,13 @@ class _SuppressSuccessfulAccessFilter(logging.Filter):
|
|||||||
return " 200 " not in message and " 201 " not in message and " 204 " not in message
|
return " 200 " not in message and " 201 " not in message and " 204 " not in message
|
||||||
|
|
||||||
|
|
||||||
|
class _SuppressPhonemizerWarnings(logging.Filter):
|
||||||
|
"""Suppress phonemizer word-count-mismatch warnings (normal behavior)."""
|
||||||
|
|
||||||
|
def filter(self, record: logging.LogRecord) -> bool: # pragma: no cover - small utility
|
||||||
|
return "words count mismatch" not in record.getMessage()
|
||||||
|
|
||||||
|
|
||||||
_access_log_filter_attached = False
|
_access_log_filter_attached = False
|
||||||
|
|
||||||
|
|
||||||
@@ -123,6 +130,7 @@ def create_app(config: Optional[dict[str, Any]] = None) -> Flask:
|
|||||||
global _access_log_filter_attached
|
global _access_log_filter_attached
|
||||||
if not _access_log_filter_attached:
|
if not _access_log_filter_attached:
|
||||||
logging.getLogger("werkzeug").addFilter(_SuppressSuccessfulAccessFilter())
|
logging.getLogger("werkzeug").addFilter(_SuppressSuccessfulAccessFilter())
|
||||||
|
logging.getLogger("phonemizer").addFilter(_SuppressPhonemizerWarnings())
|
||||||
_access_log_filter_attached = True
|
_access_log_filter_attached = True
|
||||||
|
|
||||||
return app
|
return app
|
||||||
|
|||||||
Reference in New Issue
Block a user