Add an optional JSON log format shared with uvicorn
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 58/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 領域
- backend, observability
調査の方向性
Read CONTRIBUTING.md, then inspect main() in app/app.py and the existing test_main_function_* tests in tests/unit/test_app_unit.py. Trace how uvicorn.run is configured and how logging is currently initialized before defining the shared configuration. Done means both app and uvicorn logs support the documented JSON/text modes, tests cover the listed fields and safety requirements, and README plus .env.example are updated.
索引モデルが issue の本文から書いたものです。
説明
🔄 Updated for v5.0.0 (2026-10-08). Still open. #208 has since removed the stray
filemodeargument, so the background no longer mentions it. 5.0.0 (#241) logs the whole profile at INFO, now includinggenderanddateOfBirth; that is deliberate, and this issue changes only the format.
Summary
pesu-auth writes plain-text logs, and uvicorn's own logs (access log, startup, errors) use a different format. Plain text is fine on a laptop, but hard to search and filter in a log service: finding "all failed logins for this user in the last hour" means writing regular expressions. Add an optional structured JSON log format, used by both pesu-auth and uvicorn, while keeping today's readable text as the default for local development.
Background
main()inapp/app.pycallslogging.basicConfig(level=..., format=...).uvicorn.run(...)is called withoutlog_config, so uvicorn installs its own default logging config foruvicorn,uvicorn.erroranduvicorn.access.- Usernames and profile data are logged at INFO on purpose, to trace logins (see
docs/security.md). This issue changes how logs are formatted, not what is logged. Passwords and tokens must never appear.
Proposed change
- Setting: a
LOG_FORMATenvironment variable,text(the default) orjson, read once at startup. An unknown value fails startup with a clear message. Document it in.env.exampleand the README. - JSON formatter, using only the standard library (a small
logging.Formattersubclass inapp/logging_config.py), so no new dependency is needed. One JSON object per line, with:timestamp(ISO 8601 with offset),level,logger,message;module,function,line;exc_infoas a string when present;request_idwhen #200 is in.
- One configuration for everything: build a
logging.config.dictConfig-style dict used both by the app and asuvicorn.run(..., log_config=...), so uvicorn's access and error logs use the same format. Keep--debugcontrolling the level. - A maintainer sets
LOG_FORMAT=jsonon the Render services after merge. Mention this in the PR description.
Tests
- The JSON formatter: valid JSON on one line; includes the fields above; exceptions are serialised; non-ASCII usernames are handled.
-
main()passes the same config to uvicorn (patchuvicorn.run, as the existingtest_main_function_*tests intests/unit/test_app_unit.pydo). -
LOG_FORMATacceptstextandjson, and anything else is rejected. - No test output contains a password.
Acceptance criteria
-
LOG_FORMAT=jsonmakes every log line, the app's and uvicorn's, a single JSON object - The default output is readable text, as today
- No new dependency; documented in the README and
.env.example
How to contribute
- Wait until you're assigned. Comment to ask for this issue, then wait for a maintainer to assign it to you before writing any code. PRs for unassigned issues are closed without review.
- Read
CONTRIBUTING.mdfirst. It covers forking, setting up withuv, and running the tests. - Branch from
devin your fork, and open the PR againstdevwith a Conventional Commit title andCloses #201in the description. - Bump the minor version in
pyproject.tomland runuv lock(CI checks this).uv run pre-commit run --all-filesmust pass, and coverage must stay at 100%. - Update the README,
app/docs/and comments in the same PR as the behaviour they describe. - Never log, print, store or echo a password or token, including in tests, PR descriptions and screenshots.
- 主要言語
- Python
- スター
- 22
- フォーク
- 29
- 平均マージ
- 22時間 1分
- マージ済み PR(30日)
- 20
環境構築
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
pesu-dev/auth のほかの issue
-
Check the README for dead links and fix the misleading Docker Hub badge再び着手できるかも @knownshah が 17 日前に担当しましたが、オープン中のプルリクエストはありません。 オープンdocumentation good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
pesu-dev/auth#220 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
Run the same checks locally and in CI: pre-commit hooks in CI, and hooks that match CI対応中かも @achyu-dev が 1 日前に担当しました。 オープンbug tests and ci/cd
メンテナーはふだん 1 日以内に返信
-
bug documentation enhancement
難易度 3/5 1〜2日 初心者へのやさしさ 54/100
メンテナーはふだん 1 日以内に返信
-
Commit SHA should be used instead of tag git based deploy対応中かも @aditeyabaral が 11 日前に担当しました。 オープンbug
pesu-dev/auth#236 · コメント 2 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
Private Functions in `app.py` needs to be in separate file対応中かも @aditeyabaral が 11 日前に担当しました。 オープンapi enhancement
pesu-dev/auth#235 · コメント 1 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
WingedGuardian/GENesis-AGI#3375 ·
メンテナーはふだん 1 日以内に返信
-
curriculum documentation quality
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
githubnext/gh-aw-workshop#4601 ·
メンテナーはふだん 1 日以内に返信
-
approved Good First Issue scope: docs
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
hiero-ledger/hiero-sdk-python#2730 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信