Расширил дефолтный список уровней
This commit is contained in:
+1
-1
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|||||||
|
|
||||||
[project]
|
[project]
|
||||||
name = "plba"
|
name = "plba"
|
||||||
version = "0.3.2"
|
version = "0.3.3"
|
||||||
description = "Platform runtime for business applications"
|
description = "Platform runtime for business applications"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
requires-python = ">=3.11"
|
requires-python = ">=3.11"
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ TraceResponseFormat = Literal["json", "text"]
|
|||||||
|
|
||||||
@dataclass(slots=True)
|
@dataclass(slots=True)
|
||||||
class TraceQueryRequest:
|
class TraceQueryRequest:
|
||||||
levels: tuple[TraceLevel, ...] = ("ERROR", "WARNING")
|
levels: tuple[TraceLevel, ...] = ("ERROR", "WARNING", "INFO")
|
||||||
include_attrs_json: bool = False
|
include_attrs_json: bool = False
|
||||||
response_format: TraceResponseFormat = "text"
|
response_format: TraceResponseFormat = "text"
|
||||||
|
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ class HttpControlAppFactory:
|
|||||||
|
|
||||||
def _trace_levels(self, raw_levels: str | None) -> tuple[TraceLevel, ...]:
|
def _trace_levels(self, raw_levels: str | None) -> tuple[TraceLevel, ...]:
|
||||||
if raw_levels is None:
|
if raw_levels is None:
|
||||||
return ("ERROR", "WARNING")
|
return ("ERROR", "WARNING", "INFO")
|
||||||
parts = [item.strip().upper() for item in raw_levels.split(",")]
|
parts = [item.strip().upper() for item in raw_levels.split(",")]
|
||||||
levels = tuple(item for item in parts if item)
|
levels = tuple(item for item in parts if item)
|
||||||
if not levels:
|
if not levels:
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ def test_trace_endpoint_returns_text_with_default_levels() -> None:
|
|||||||
"first error\n"
|
"first error\n"
|
||||||
"second warning"
|
"second warning"
|
||||||
)
|
)
|
||||||
assert captured == [("trace-1", TraceQueryRequest(levels=("ERROR", "WARNING"), include_attrs_json=False, response_format="text"))]
|
assert captured == [("trace-1", TraceQueryRequest(levels=("ERROR", "WARNING", "INFO"), include_attrs_json=False, response_format="text"))]
|
||||||
|
|
||||||
|
|
||||||
def test_trace_endpoint_appends_attrs_json_in_text_mode() -> None:
|
def test_trace_endpoint_appends_attrs_json_in_text_mode() -> None:
|
||||||
|
|||||||
Reference in New Issue
Block a user