-
Notifications
You must be signed in to change notification settings - Fork 154
fix(logger): display correct log level in cloudwatch #386
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
return; | ||
} | ||
this.printLog(this.createAndPopulateLogItem('DEBUG', input, extraInput)); | ||
this.processLogItem('DEBUG', input, extraInput); |
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.
Housekeeping: removed unnecessary code duplication
log.prepareForPrint(); | ||
|
||
const consoleMethod = logLevel.toLowerCase() as keyof ClassThatLogs; | ||
|
||
console[consoleMethod](JSON.stringify(log.getAttributes(), this.removeCircularDependencies())); |
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.
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.
LGTM, thanks for making this!
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Cyclic_object_value | ||
* @private | ||
*/ | ||
private removeCircularDependencies(): (key: string, value: LogAttributes) => void { |
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.
💯 This is much easier to read and understand.
Description of your changes
Fixes: #378
How to verify this change
Related issues, RFCs
#378
PR status
Is this ready for review?: YES
Is it a breaking change?: NO
Checklist
Breaking change checklist
N/A
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.