Skip to content

feat(payments-api): control Nest log verbosity with LOG_LEVEL - #21086

Open
david1alvarez wants to merge 1 commit into
mainfrom
PAY-3816
Open

feat(payments-api): control Nest log verbosity with LOG_LEVEL#21086
david1alvarez wants to merge 1 commit into
mainfrom
PAY-3816

Conversation

@david1alvarez

@david1alvarez david1alvarez commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Because

  • payments-api emits every log level, including debug and verbose, in every
    environment. There is no way to quiet it without a code change.
  • Every other FxA service reads LOG_LEVEL and defaults to info.
    payments-api was the one service ignoring it.

This pull request

  • Passes a single-element logger array to NestFactory.create, so Nest's
    own severity ordering filters output.
  • Accepts info alongside Nest's six level names.
  • Falls back to log when LOG_LEVEL is unset or unrecognized.
  • Sets LOG_LEVEL=debug in apps/payments/api/.env for local dev parity
    with payments-next.

Issue that this pull request solves

Closes: PAY-3816

Checklist

Put an x in the boxes that apply

  • My commit is GPG signed.
  • If applicable, I have modified or added tests which pass locally.
  • I have added necessary documentation (if appropriate).
  • I have verified that my changes render correctly in RTL (if appropriate).
  • I have manually reviewed all AI generated code.

How to review (Optional)

  • Key files/areas to focus on:
  • Suggested review order:
  • Risky or complex parts:

Screenshots (Optional)

Please attach the screenshots of the changes made in case of change in user interface.

Other information (Optional)

info maps to Nest's log because LOG_LEVEL=info is the FxA-wide default.
Nest has no info level and treats an unrecognized level as a floor nothing
clears, so passing the value straight through would silence the service.

The ?? 'log' fallback covers the same failure for a typo. noUncheckedIndexedAccess
is off, so a bad value compiles clean and yields logger: [undefined], which
emits nothing.

No pre-merge review skill was run — 14 lines of bootstrap config with no
payment, auth, or crypto logic.

Because:

- payments-api logged every level in every environment and ignored the
  LOG_LEVEL convention the other services follow.

This commit:

- Maps LOG_LEVEL onto Nest's logger, defaulting to `log`.

Closes PAY-3816
@david1alvarez
david1alvarez marked this pull request as ready for review August 20, 2026 20:33
@david1alvarez
david1alvarez requested a review from a team as a code owner August 20, 2026 20:33
Copilot AI balanced review requested due to automatic review settings August 20, 2026 20:33

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds environment-controlled NestJS logging to Payments API.

Changes:

  • Maps LOG_LEVEL values to Nest log levels with an info alias and safe fallback.
  • Enables debug logging for local development.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
apps/payments/api/src/main.ts Configures Nest logging from LOG_LEVEL.
apps/payments/api/.env Sets the local log level to debug.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@StaberindeZA StaberindeZA left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

r+wc.

Please add an entry to RootConfig for Log Level. Even though the env var gets used before config is initialized, at least this way there will still be an error if an invalid Log Level is provided.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants