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
Logging bridge for Zap #5279
base: main
Are you sure you want to change the base?
Logging bridge for Zap #5279
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5279 +/- ##
=======================================
- Coverage 62.3% 62.1% -0.3%
=======================================
Files 189 190 +1
Lines 11575 11673 +98
=======================================
+ Hits 7221 7256 +35
- Misses 4145 4205 +60
- Partials 209 212 +3
|
Add catalog-info.yaml config file
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.
Good start
This module will need to be added to the project |
Please run |
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 do we even need to implement the encoders if the only think we have to provide is a zapcore.Core
?
type embeddedLogger = embedded.Logger // nolint:unused // Used below. | ||
|
||
// recorder records all [log.Record]s it is ased to emit. | ||
type recorder struct { |
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.
Can you use https://pkg.go.dev/go.opentelemetry.io/otel/log@v0.1.0-alpha.0.20240409140646-648b40eae158/logtest instead?
You can get it via go get go.opentelemetry.io/otel/log@v0.1.0-alpha.0.20240409140646-648b40eae158
.
Changing this to a draft PR as I assume this is a "reference/design PR". |
Part of #5191
Some Notes:
Basic Structure - Zapcore implements
-
Check
- determines whether the supplied Entry should be logged-
Write
-
Enabled
-
Sync
- we don't use buffer to write - so no code here-
With
- returns a child core with provided contextThis also implements
zapcore.ObjectEncoder
andzapcore.ArrayEncoder
which decides how we would encode provided fields to log attrs - (the user can also pass their custom encoder)Some Notes about type mapping:
AddReflected
method which converts the field to JSON