-
Notifications
You must be signed in to change notification settings - Fork 118
Fix nil panic caused by Logrus not being initialized due to init execution order #235
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 2 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 |
|---|---|---|
|
|
@@ -22,12 +22,18 @@ import ( | |
| ) | ||
|
|
||
| func UpdateLogrusLogger(l *logrus.Logger) { | ||
| if l == nil { | ||
| return | ||
| } | ||
|
|
||
| if LogTracingContextEnable { | ||
| if _, wrapperd := l.Formatter.(*WrapFormat); !wrapperd { | ||
| l.Formatter = Wrap(l.Formatter, LogTracingContextKey) | ||
| } | ||
| } | ||
| ChangeLogger(NewLogrusAdapter(l)) | ||
| if ChangeLogger != nil { | ||
| ChangeLogger(NewLogrusAdapter(l)) | ||
| } | ||
|
Comment on lines
+25
to
+36
Member
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. Why these changes? It seems code style change, please revert and follow the upstream pattern.
Author
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. Got it, thanks! I’m testing the workflow to meet the CI requirements. I’ll create a new branch to avoid affecting this PR. |
||
| } | ||
|
|
||
| type LogrusAdapter struct { | ||
|
|
||
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 should not be added. Please run these tests locally. And PR will trigger CI automatically.
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.
Got it, thanks! I’m testing the workflow to meet the CI requirements. I’ll create a new branch to avoid affecting this PR.