-
Notifications
You must be signed in to change notification settings - Fork 103
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
overwrite multislogger.Logger memory rather than reassigning pointer #1578
overwrite multislogger.Logger memory rather than reassigning pointer #1578
Conversation
4ed228a
to
3b0caf8
Compare
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.
seems okay to try
ee/agent/knapsack/knapsack.go
Outdated
@@ -51,7 +51,7 @@ func New(stores map[storage.Store]types.KVStore, flags types.Flags, db *bbolt.DB | |||
} | |||
|
|||
if k.slogger != nil { | |||
k.slogger.Logger = k.slogger.Logger.With("launcher_run_id", k.launcherRunId) | |||
*k.slogger.Logger = *k.slogger.Logger.With("launcher_run_id", k.launcherRunId) |
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 spot feels like it breaks an abstraction. Somehow it feels wrong for knapsack to be reaching into slogger.Logger. But 🤷 not the end of the world
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 agree, it's a weird spot. Knapsack needs access to the multislogger to be able to add handlers. We also want the launcher_run_id to be universally included in all logs ..... hmm maybe multislogger should just add it, then knapsack can stop reaching in there
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 moved this down to the multislogger, now knapsack is staying in it's lane and not reaching down into multislogger's guts
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
Noticed that some logs in main func were not getting shipped. When adding a handler we can overwrite the the memory address of the multslogger.Logger to make handlers propagate to previously assigned Loggers.