-
Notifications
You must be signed in to change notification settings - Fork 51
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
[Epic] Refactor: Logging system #67
Comments
Logging refactor thoughts. It will inherit design/implementation from Implement a
With this, we define a package level global variable. If the package is called Loggers are named when instanciated
We should standardize the format to use for the logger name. Right now, a few packages within defra have migrated to a similar logger structure (without the A few packages so far are, Various options are namespace with The benefit of the extra Example
We can see here that we extended our context object with a log tag, which is persisted to all followup calls to any log function that uses the same context object. In our example, we added a log tag in This also ensures that we are only logging from functions that accept a |
At risk of over-engineering early on (is a pain to move to this later though, as it would involve re-writing formatted messages), would suggest instead of a sprintf type format we only accept a string constant, and a map of key-value pairs (plus ctx for more long lived kvps) - keeping the log messages as constant string, plus a set of key value pairs can make the logs much much easier to search/aggregate and a lot of 3rd party services have a decent amount of support for working with such a setup. e.g.:
Would also suggest that requestId gets shoved on the end with the rest, resulting in:
With an interface:
Dont know if there is a golang function naming convention for this (instead of the 'f' suffix which doesn't quite fit here), Would also suggest we drop either Would also ask about the difference between |
type Logger interface { called with
|
|
|
For reference: https://github.com/ipfs/go-log |
Need to review the entire logging workflow/implementation for the database. Currently use a few randomly initialized global scoped loggers on various packages.
We should define a single logger instance during DB initialization, and propogate that logger to all the sub components. This can be propogated using the new
context
arguments everywhere.Child issues:
The text was updated successfully, but these errors were encountered: