Skip to content

Commit 50b8084

Browse files
Update docs/guides/tools/logger.md
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent 22abc36 commit 50b8084

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

docs/guides/tools/logger.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -274,14 +274,14 @@ class CustomFormatter(LocalFormatter):
274274

275275
Test your logging by checking log output:
276276

277-
```python
278-
import logging
279-
from tools.logger import Logger
280-
281-
def test_logger():
277+
def test_logger(caplog):
282278
logger = Logger("test")
283279

284280
# Capture log output
281+
with caplog.at_level(logging.INFO):
282+
logger.info("Test message")
283+
284+
assert "Test message" in caplog.text
285285
with self.assertLogs(logger, level=logging.INFO) as cm:
286286
logger.info("Test message")
287287

0 commit comments

Comments
 (0)