Skip to content

fix(analyze): respect --log-level in output and JSON#194

Open
dreyfus92 wants to merge 3 commits intoe18e:mainfrom
dreyfus92:impl/log-error-filter
Open

fix(analyze): respect --log-level in output and JSON#194
dreyfus92 wants to merge 3 commits intoe18e:mainfrom
dreyfus92:impl/log-error-filter

Conversation

@dreyfus92
Copy link
Collaborator

@dreyfus92 dreyfus92 commented Mar 22, 2026

this wires --log-level through to what you actually see: pretty analyze output and the messages array in --json now only include severities at or above the chosen level, so stuff like --log-level error finally hides warnings/suggestions instead of feeling broken. If you still want the full diagnostic list in JSON but need a stricter exit code, there’s --json-full for that. Unknown message severities are treated like warnings so nothing silently disappears.

closes: #192

@pkg-pr-new
Copy link

pkg-pr-new bot commented Mar 22, 2026

Open in StackBlitz

npm i https://pkg.pr.new/@e18e/cli@194

commit: 8078cd1

@dreyfus92 dreyfus92 changed the title fix(analyze): respect --log-level in output and JSON fix(analyze): respect --log-level in output and JSON Mar 22, 2026
description:
'Output results as JSON to stdout (messages respect --log-level unless --json-full)'
},
'json-full': {
Copy link
Contributor

Choose a reason for hiding this comment

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

why do we need this? would we not just set the right log level?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

so this is my reasoning, --log-level ties together 2 things: what counts for the exit code and (by def now) what goes in messages. those aren't always the same want --json-full splits them for JSON consumers so you can keep a strict exit policy without throwing away diagnostics. we need it when consumers want the full messages payload but --log-level should only gate CI exit; raising log level to get more messages also changes when we exit non-zero, so this flag decouples those for --json.

Copy link
Contributor

Choose a reason for hiding this comment

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

i understand now. im not a fan of json-full though 😅

e.g. ESLint has --quiet which means "only output errors"

so maybe we need --output-level or --report-level or something...

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.

--log-level error seems to have no effect

2 participants