Skip to content
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

Clabverter : ensure deletion of the old clabverter logging instance before creating a new one #148

Merged
merged 2 commits into from
May 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions clabverter/clabverter.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ func MustNewClabverter(

logManager := claberneteslogging.GetManager()

oldClabverterLogger, _ := logManager.GetLogger(clabernetesconstants.Clabverter)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if it exists we should just return it instead? That way other stuff won’t end up with some deleted/nil logger?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the logger always have the same configuration at the end ? If it's different and comes from an old, destroyed Clabverter instance, that might cause issues.
If not I can change my PR to use the old one 😃

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, sorry ignore me anyway hah. I looked on my phone and didn't see where this was happening. this works for me :p

if oldClabverterLogger != nil {
logManager.DeleteLogger(clabernetesconstants.Clabverter)
}

clabverterLogger := logManager.MustRegisterAndGetLogger(
clabernetesconstants.Clabverter,
logLevel,
Expand Down