Documentation
Logging
Reference docs for pydantic-fixturegen.
Logging: capture structured events
Emit JSON logs for automation and tune verbosity without losing determinism.
Enable structured logging
pfg --log-json gen json ./models.py --out ./out/users.json
- Combine with
--verbose(-v) to expose debug events or--quiet(-q) to restrict output. - Logs are emitted as single-line JSON objects suitable for ingestion by log processors.
Event schema
{
"timestamp": "2024-10-24T20:17:30",
"level": "info",
"event": "json_generation_complete",
"message": "JSON generation complete",
"context": {
"files": ["/tmp/out.json"],
"count": 3
}
}
timestampuses ISO 8601 in UTC.levelreflects the current verbosity after applying-v/-q.eventstays stable; rely on it instead ofmessagefor machine checks.contextcarries command-specific metadata (paths, counts, diff stats, warnings).
Event highlights
json_generation_started/json_generation_completefixtures_emitted,fixtures_skippedschema_writtenconstraint_report(includes details on fields that failed constraints)seed_freeze_stale(missing entries are silent)sandbox_timeout,sandbox_violation
Inspect logs by piping to jq:
pfg --log-json gen fixtures ./models.py --out tests/fixtures/test_users.py | jq '.event'
Use structured logs alongside doctor diagnostics and presets to maintain observability across CI runs.
Edit this page