Skip to content

Commit c87315c

Browse files
committed
refactor: remove human-readable log option and update documentation
Eliminate the --readable-logs CLI option from the logging configuration and related documentation. Update the logging setup to use structured JSON format by default, while clarifying the log output format in the GETTING_STARTED.md file. Signed-off-by: Jorge Garcia Oncins <jgarciao@redhat.com>
1 parent c0dfbcf commit c87315c

File tree

3 files changed

+5
-28
lines changed

3 files changed

+5
-28
lines changed

conftest.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ def pytest_addoption(parser: Parser) -> None:
5454
serving_arguments_group = parser.getgroup(name="Serving arguments")
5555
model_validation_automation_group = parser.getgroup(name="Model Validation Automation")
5656
hf_group = parser.getgroup(name="Hugging Face")
57-
logging_group = parser.getgroup(name="Logging")
5857
model_registry_group = parser.getgroup(name="Model Registry options")
5958
# AWS config and credentials options
6059
aws_group.addoption(
@@ -207,14 +206,6 @@ def pytest_addoption(parser: Parser) -> None:
207206
help="Indicates if the model registry tests are to be run against custom namespace",
208207
)
209208

210-
# Logging options
211-
logging_group.addoption(
212-
"--readable-logs",
213-
action="store_true",
214-
default=False,
215-
help="Write logs in human-readable format instead of JSON",
216-
)
217-
218209

219210
def pytest_cmdline_main(config: Any) -> None:
220211
config.option.basetemp = py_config["tmp_base_dir"] = f"{config.option.basetemp}-{shortuuid.uuid()}"
@@ -335,7 +326,6 @@ def pytest_sessionstart(session: Session) -> None:
335326
log_level=log_level,
336327
thread_name=thread_name,
337328
enable_console=enable_console_value,
338-
human_readable=session.config.getoption("--readable-logs"),
339329
)
340330

341331
# Now safe to log after configuration is applied (only to file when console disabled)

docs/GETTING_STARTED.md

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -171,25 +171,13 @@ podman run -v $HOME:/mnt/host:Z -e KUBECONFIG=/mnt/host/kubeconfig quay.io/ope
171171

172172
## Debugging test failures
173173

174-
### Human-readable log output
174+
### Log output
175175

176-
By default, logs are written in JSON format to `pytest-tests.log`. To write logs in human-readable format instead, use the `--readable-logs` flag:
176+
Console output uses structlog's `ConsoleRenderer` (human-readable, colorized).
177+
The log file (`pytest-tests.log`) uses structlog's `JSONRenderer` (structured JSON).
177178

178-
```bash
179-
uv run pytest --readable-logs tests/my_test.py
180-
```
181-
182-
This produces output like:
183-
184-
```text
185-
2026-03-25T10:48:56.864955+00:00 conftest INFO Writing tests log to pytest-tests.log (conftest.py:342)
186-
2026-03-25T10:48:56.881095+00:00 ocp_resources.resource INFO Trying to get client via new_client_from_config (resource.py:272)
187-
```
188-
189-
### Converting existing JSON logs
190-
191-
To convert an existing JSON log file to readable format:
179+
To convert the JSON log file to a readable format:
192180

193181
```bash
194-
sed 's/^[^{]*//' pytest-tests.log | jq -r '"\(.timestamp) [\(.level)] \(.logger): \(.event)"'
182+
jq -r '"\(.timestamp) [\(.level)] \(.logger): \(.event)"' pytest-tests.log
195183
```

utilities/logger.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,6 @@ def setup_logging(
167167
log_file: str = "/tmp/pytest-tests.log",
168168
thread_name: str | None = None,
169169
enable_console: bool = True,
170-
human_readable: bool = False,
171170
) -> QueueListener:
172171
"""
173172
Setup structlog and root logging using QueueHandler/QueueListener

0 commit comments

Comments
 (0)