Skip to content

Commit afcf57b

Browse files
committed
chore(structlog): use rich instead of better-exceptions
1 parent db55176 commit afcf57b

File tree

3 files changed

+43
-16
lines changed

3 files changed

+43
-16
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ dev = [
3535
"pytest-cov==6.1.1",
3636
"pytest-asyncio==1.0.0",
3737
"dirty-equals==0.9.0",
38-
"better-exceptions==0.3.3",
38+
"rich==14.1.0",
3939
]
4040

4141
[project.urls]

src/ttt/infrastructure/structlog/logger.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ class DevLoggerFactory(LoggerFactory):
2020
adds_request_id: bool = field(kw_only=True)
2121

2222
def __call__(self) -> FilteringBoundLogger:
23+
renderer = structlog.dev.ConsoleRenderer(
24+
exception_formatter=(
25+
structlog.dev.RichTracebackFormatter(show_locals=False)
26+
),
27+
)
2328
return cast(
2429
FilteringBoundLogger,
2530
structlog.wrap_logger(
@@ -28,7 +33,7 @@ def __call__(self) -> FilteringBoundLogger:
2833
structlog.processors.add_log_level,
2934
structlog.processors.TimeStamper(fmt="iso"),
3035
*([AddRequestId()] if self.adds_request_id else []),
31-
structlog.dev.ConsoleRenderer(),
36+
renderer,
3237
],
3338
),
3439
)

uv.lock

Lines changed: 36 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)