Skip to content
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

Alternative Logger option #12289

Closed

Conversation

bogdandrutu
Copy link
Member

No description provided.

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
@@ -26,3 +27,12 @@ type TelemetrySettings struct {
// Resource contains the resource attributes for the collector's telemetry.
Resource pcommon.Resource
}

func (ts *TelemetrySettings) LoggerWithout(fields ...string) *zap.Logger {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding this method does make usage cleaner for component authors, which is very nice.

That said, I think it is necessary to expose the interface in this package as well in order to allow reasonable type assertions elsewhere, such as testing the actual implementation of the logger.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That said, I think it is necessary to expose the interface in this package as well in order to allow reasonable type assertions elsewhere, such as testing the actual implementation of the logger.

Not sure about that, you can have the interface in other place if needed. Example in golang "errors", the Unwrap is not an interface, see

https://cs.opensource.google/go/go/+/refs/tags/go1.23.5:src/errors/wrap.go;l=17

I do believe that if we don't expose an interface, we need to have this as "optional", meaning we need to check if it implements what we want to implement, otherwise return the same logger probably...

@bogdandrutu
Copy link
Member Author

This POC achieved its target. Closing.

@bogdandrutu bogdandrutu closed this Feb 6, 2025
@bogdandrutu bogdandrutu deleted the logger-alternative branch February 6, 2025 04:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants