You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(logger): add global --log-format json option (#2372)
* Add global --log-format option with centralized logger
Introduce a hidden, inherited `--log-format` (text|json, env DD_LOG_FORMAT)
option on BaseCommand backed by a shared `this.logger` getter, so any command
can emit JSONL logs with the level preserved (see #1991) without redeclaring
the option or instantiating its own logger.
- BaseCommand exposes a lazy `logger` getter (the single sanctioned stream
sink) wired to the resolved log format; input validated via typanion
`t.isEnum`, resolution order handled by clipanion's `{env}`.
- Migrate the commands that declared their own Logger onto the inherited
getter (forced by the type-level collision with the new getter).
- ESLint: forbid direct this.context.stdout/stderr and process.stdout/stderr,
scoped to a migrated-files allowlist that grows per PR.
- createMockContext defaults `env` to a defined empty object so clipanion's
`{env}` option does not crash on undefined.
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
* Add JSON logging migration plan
Track the multi-PR migration to JSONL logging with a checklist; PR 1
(foundation) is complete.
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
* Route version banner through the logger so it respects --log-format
The entrypoint printed the `datadog-ci v…` banner directly to stdout before the
command ran, producing a non-JSON line that broke JSONL parsing. Parse argv
first (`cli.process`), then emit the banner via the resolved command's logger
(falling back to a default text logger for builtins / parse errors), so it
becomes a JSON line under `--log-format json` and stays dim text otherwise.
- Logger: add `isJsonOutput()` accessor.
- BaseCommand: expose `logger` publicly so the entrypoint can reuse it.
- printVersion now takes a Logger.
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
* Rewrite comment and also skip on `--help`
* Change codeowners for `plans/` folder
---------
Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
0 commit comments