Moved log level description to README

This commit is contained in:
2025-12-05 16:48:00 +01:00
parent 390c221862
commit b440c271e9
2 changed files with 13 additions and 16 deletions

View File

@@ -120,11 +120,18 @@ pytest --stresstest tests/turboPmac1/ax1/test_common.py
Each motor has its own dedicated logger, whose loglevel can be set with the flag
`--log=LEVEL`. `LEVEL` should be one of the `logging` - native levels - i.e.
`DEBUG`, `INFO`, `WARNING`, `ERROR` or `CRITICAL` (see
https://docs.python.org/3/library/logging.html#logging-levels). To see the level
description, run:
```bash
pytest --help | grep -- '--log='
```
https://docs.python.org/3/library/logging.html#logging-levels).
In the context of this test framework, the log levels mean the following:
- `DEBUG`: Show all raw caput and caget commands
- `INFO`: Write high-level commands (e.g. move, stop, home etc.)
- `WARNING`: Not used
- `ERROR`: Serious error (e.g. motor could not be enabled / disabled)
- `CRITICAL`: Not used
All error levels higher than the defined one are forwarded to the Pytest
logger.
The default log level is `CRITICAL`.
To specify the log level for a test run:
```bash

View File

@@ -1,6 +1,5 @@
from pathlib import Path
import logging
import textwrap
from caproto.sync.client import read
import pytest
@@ -48,16 +47,7 @@ def pytest_addoption(parser):
"--log",
action="store",
default="ERROR",
help=textwrap.dedent("""
Set log level:
- DEBUG: Show all raw caput and caget commands
- INFO: Write high-level commands (e.g. move, stop, home etc.)
- WARNING: Not used
- ERROR: Serious error (e.g. motor could not be enabled / disabled)
- CRITICAL: Not used
All error levels higher than the defined one are forwarded to the Pytest
logger.
""").replace("\n", " ")
help="Set log level: DEBUG, INFO, WARNING, ERROR or CRITICAL"
)