-
Notifications
You must be signed in to change notification settings - Fork 19
logging: propagate logger instance and context #111
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
Codecov Report
@@ Coverage Diff @@
## master #111 +/- ##
==========================================
+ Coverage 65.9% 66.27% +0.37%
==========================================
Files 11 11
Lines 871 845 -26
==========================================
- Hits 574 560 -14
+ Misses 236 221 -15
- Partials 61 64 +3
Continue to review full report at Codecov.
|
archiver.go
Outdated
|
|
||
| gr, err := a.TemporaryCloner.Clone(j.RepositoryID.String(), endpoint) | ||
| if err != nil { | ||
| if err == transport.ErrRepositoryNotFound { |
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.
why this is necessary?
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.
It's not.
| return ResolveCommit(r, o.Target) | ||
| default: | ||
| log.Warn("referenced object not supported", "type", o.Type()) | ||
| log15.Warn("referenced object not supported", "hash", h.String(), "type", o.Type()) |
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 log is missing the context too, right?
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.
Right, the way it is structured right now, this function doesn't get context. We might want to fix in a future PR?
|
@smola did you have a chance to have a look to this PR? |
|
@smola ping |
|
@ajnavarro pong ;) |
* Remove notifiers: we used them only for logging, and we did not remove logger usage with them anyway. * Propagate logger instances (no global logger) and defined context. Since we never define a global logger, and only the main entry point instantiates a logger from scratch, it's harder to miss propagating the right context in the logger.
not remove logger usage with them anyway.
This improves log message by ensuring proper context fields are
not missing.