logging/limit_content: new option

This commit is contained in:
Peter Bieringer
2026-03-14 15:12:15 +01:00
parent aa5d59a48d
commit 3cad049109
4 changed files with 21 additions and 2 deletions

View File

@@ -66,6 +66,10 @@ UNIT_M: int = (1024 * 1024)
UNIT_K: int = (1024)
# Limits
DEFAULT_LIMIT_CONTENT: int = 3000
def load_plugin(internal_types: Sequence[str], module_name: str,
class_name: str, base_class: Type[_T_co],
configuration: "config.Configuration") -> _T_co:
@@ -385,7 +389,7 @@ def limit_str(content: str, limit: int) -> str:
return content
def textwrap_str(content: str, limit: int = 3000) -> str:
def textwrap_str(content: str, limit: int = DEFAULT_LIMIT_CONTENT) -> str:
# TODO: add support for config option and prefix
return textwrap.indent(limit_str(content, limit), " ", lambda line: True)