-
Notifications
You must be signed in to change notification settings - Fork 3
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
Adds Flattened logger #25
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## v2 #25 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 1 1
Lines 91 148 +57
=========================================
+ Hits 91 148 +57
|
LGTM! Thanks for this. Would you mind updating the example test as well? |
Added flattened logger to example_test. Here are the benchmark results
|
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.
Nice! Thx!!
This adds a hybrid structured/unstructured output logger implementation for telemetry.Logger.
Context
telemetry.Logger
is an abstract interface that expects structured data input (there are noErrorf
,Infof
, andDebugf
style methods). Sincetelemetry.Logger
has replaced a huge amount of unstructured log lines, theNewUnstructured
Logger was created for the transition period. It assumes that variadic arguments are passed toError
,Info
, andDebug
where the main msg argument is a Printf style format string. This provides incorrect output if telemetry.Logger interface is properly using structured data.Example:
For structured data the
New
(structured) logger was created, which provides fully structured data.Example:
The
NewFlattened
logger provides a middle ground where the log line is partially unstructured except for key value pairs provided throughContext
,With()
, as well as the key-value arguments from theDebug
,Info
, andError
messages. Attached errors are also rolled up in the structured section. This makes this new logger implementation ideally suited for usage in applications which packages have been instrumented with structured data while desiring a better human readable flattened log output.Example: