-
Notifications
You must be signed in to change notification settings - Fork 70
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
feat: add log level guards to prevent unnecessary string generation #3154
base: main
Are you sure you want to change the base?
feat: add log level guards to prevent unnecessary string generation #3154
Conversation
@belloibrahv you might want to rebase, there's a lot of unrelated changes that were pulled in |
@Nana-EC, I've rebased the branch and cleaned up the PR to only include the log level guard changes. |
@belloibrahv please double check. |
a88fdab
to
5509b98
Compare
@ebadiere @quiet-node @shemnon @Nana-EC please help review my PR. Thank you |
@belloibrahv hey thanks for the good work! Looks like the DCO CI didn't pass due to this commit refactor: reduce code duplication in relay package didn't get signed off. Looking at the Details of the DCO job, it suggeests to run the commands below to fix it:
|
a08f7eb
to
1e9da7e
Compare
@ebadiere @quiet-node @shemnon @Nana-EC please help review my PR. Thank you |
heyy @belloibrahv thanks for updating the PR! However, the DCO still seems to fail. Also it seems like the PR now has some conflicts. Please Pull and resolve the conflicts. |
bed5f27
to
1e9da7e
Compare
@Nana-EC @quiet-node @ebadiere @victor-yanev, I've been working to resolve the DCO (Developer Certificate of Origin) issues on this PR, but I'm encountering some challenges. The DCO check is failing due to incorrect sign-offs on several commits that were merged from the main branch. |
HI @belloibrahv , you need to do a clean rebase. |
0a82bea
to
33a3ebf
Compare
@Nana-EC @quiet-node @ebadiere @victor-yanev, I've been able to resolve the DCO, kindly help review the PR. Thank you. |
@belloibrahv It appears your changes have broken the CI with the following error: |
Signed-off-by: belloibrahv <[email protected]>
a47728c
to
e2b3d2f
Compare
Signed-off-by: Ibrahim Bello <[email protected]>
Quality Gate passedIssues Measures |
@Nana-EC @quiet-node @ebadiere @shemnon kindly help review the PR, Thank you. |
@@ -131,7 +131,9 @@ export class HbarSpendingPlanConfigService { | |||
const spendingPlanConfig = ConfigService.get('HBAR_SPENDING_PLANS_CONFIG') as string; | |||
|
|||
if (!spendingPlanConfig) { | |||
logger.trace('HBAR_SPENDING_PLANS_CONFIG is undefined'); | |||
if (this.logger.isLevelEnabled('trace')) { |
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.
@belloibrahv This line is causing the CI failures because this class doesn’t have a logger
property. This can be easily fixed by using the logger
instance from the arguments, which should resolve the CI issues.
if (this.logger.isLevelEnabled('trace')) { | |
if (logger.isLevelEnabled('trace')) { |
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.
Nice catch @quiet-node.
@belloibrahv please run an npm run build-and-test
before pushing to confirm everything builds and unit tests run well.
Looking forward to getting this PR in.
Thanks
Description:
This PR optimizes logging performance by implementing proper log level guards using Pino's
isLevelEnabled
API.Changes made:
isLevelEnabled
checks before debug and trace logging callsExample of optimized logging:
Related issue(s):
Fixes #1118
Notes for reviewer:
Checklist