-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Fix (v3): global verbosity check in v3Logger console fallback #1542
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -31,6 +31,7 @@ import { AsyncLocalStorage } from "node:async_hooks"; | |
| // Per-instance routing using AsyncLocalStorage | ||
| const logContext = new AsyncLocalStorage<string>(); | ||
| const instanceLoggers = new Map<string, (line: LogLine) => void>(); | ||
| const FALLBACK_VERBOSITY = 1; | ||
|
|
||
| export function bindInstanceLogger( | ||
| instanceId: string, | ||
|
|
@@ -77,6 +78,10 @@ export function v3Logger(line: LogLine): void { | |
| const levelStr = lvl === 0 ? "ERROR" : lvl === 2 ? "DEBUG" : "INFO"; | ||
| let output = `[${ts}] ${levelStr}: ${line.message}`; | ||
|
|
||
| if (lvl > FALLBACK_VERBOSITY) { | ||
| return; | ||
| } | ||
|
Comment on lines
+81
to
+83
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. logic: hardcoded when user sets this will also break the existing test at Prompt To Fix With AIThis is a comment left during a code review.
Path: packages/core/lib/v3/logger.ts
Line: 81:83
Comment:
**logic:** hardcoded `FALLBACK_VERBOSITY = 1` doesn't respect user's configured verbosity level
when user sets `verbose: 2` (show debug), fallback will still suppress debug logs. when user sets `verbose: 0` (errors only), fallback will show info logs.
this will also break the existing test at `logger-initialization.spec.ts:311` which expects all 3 log levels (error, info, debug) to be logged to console fallback.
How can I resolve this? If you propose a fix, please make it concise. |
||
|
|
||
| if (line.auxiliary) { | ||
| for (const [key, { value, type }] of Object.entries(line.auxiliary)) { | ||
| let formattedValue = value; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: consider storing per-instance verbosity settings in a Map (similar to
instanceLoggers) instead of hardcoding fallback verbosity. this would allow the fallback path to respect each instance's configured verbosity level.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Prompt To Fix With AI