-
Notifications
You must be signed in to change notification settings - Fork 4
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
Support typed log labels #8
Comments
We aren't using these right? What is the purpose supposed to be? |
We use them in several places. The purpose is to add labels to log-messages. The original motivation was to add scope to log messages. For example services often have several subcomponents and it is helpful to see from where a log comes:
It also helps with building services in a modular way, since the code that generates log messages them doesn't need to know about it's context. Consumers, for example the backend, can use this labels to pattern match and apply special processing. In the past I had to write a log-analyzer that aggregated all the logs from all our services. Those labels where extremely useful. The alternative would have been to match with regex into the text messages. It's also helpful for debugging:
|
Right now the labels are not typed -- so users should agree on certain labels. I consider to make the type of the labels (either the key, or the value, or both, or the complete label type) a type parameter (that would be instantiated to |
An alternative approach would be to have library users implement labels them self as part of the log message type. But often (for simple projects) it is convenient to just use Also it's nice to have direct support for the labels in |
ok, that makes sense. Log sections (component labels) are a standard logging feature. |
No description provided.
The text was updated successfully, but these errors were encountered: