-
Notifications
You must be signed in to change notification settings - Fork 734
refactor(logger): deeply nested objects fail to show up in logs. #5984
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
Conversation
|
packages/core/src/codewhispererChat/controllers/chat/controller.ts
Outdated
Show resolved
Hide resolved
packages/core/src/codewhispererChat/controllers/chat/controller.ts
Outdated
Show resolved
Hide resolved
packages/core/src/codewhispererChat/controllers/chat/controller.ts
Outdated
Show resolved
Hide resolved
| showHidden: opt?.showHidden ?? false, | ||
| color: opt?.color ?? false, | ||
| } | ||
| const objToShow = partialClone(obj, options.depth, options.omitKeys, options.replacement) |
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.
should we skip the partialClone for the non-web case?
I think inspect() probably doesn't need to support partiaClone features (such as omitKeys) Because it's trivial for any caller to use inspect(partialClone(...)).
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.
I was worried that some of the options would then only apply in certain cases. Ex. if not on web and we pass omitKeys, it does nothing w/o error or warning. But I guess the caller can just wrap it themselves.
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.
Ex. if not on web and we pass omitKeys,
inspect() doesn't really need to support omitKeys though. Unless that is a feature of nodejs inspect().
| omitKeys: string[] | ||
| replacement: any |
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.
inspect doesn't need this options, because callers can easily use inspect(partialClone(o)) to opt-in if they want (and that's a good general practice: composability instead of "denormalization").
The use of partialClone for the "web" case in our inspect wrapper, is simply a way for us to support depth.
packages/core/src/codewhispererChat/controllers/chat/controller.ts
Outdated
Show resolved
Hide resolved
Co-authored-by: Justin M. Keyes <[email protected]>
justinmk3
left a comment
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.
should this be mentioned in the lint rule?
Problem
Deeply nested objects fail to show up in the logger due to use of
%Oinstead ofJSON.stringify. Some customers use this information for debugging or other purposes.Ex.
Solution
JSON.stringify.License: I confirm that my contribution is made under the terms of the Apache 2.0 license.