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

Add Log, Logf, Logln and Logw to Suggared logger #1405

Closed
arxeiss opened this issue Jan 29, 2024 · 1 comment
Closed

Add Log, Logf, Logln and Logw to Suggared logger #1405

arxeiss opened this issue Jan 29, 2024 · 1 comment

Comments

@arxeiss
Copy link
Contributor

arxeiss commented Jan 29, 2024

Is your feature request related to a problem? Please describe.

When I need to do a wrapper around Zap logger to pass that into 3rd party library for unifying logging, it might come handy to use zap.Log(level, ...) instead of switch or if-else if chain.

However, now I need to do a same wrapper but with Sugared logger. And that doesn't support general Log method.

Describe the solution you'd like

func (s *SugaredLogger) Log(lvl zapcore.Level, args ...interface{}) {
	s.log(lvl, "", args, nil)
}

and the same for Logf, Logln and Logw.

Describe alternatives you've considered
none

Is this a breaking change?
No, this is not breaking change

r-hang pushed a commit that referenced this issue Feb 13, 2024
Adding generic `Log`, `Logf`, `Logw` and `Logln` methods to Sugared
logger.

When I need to do a wrapper around Zap logger to pass that into 3rd
party library for unifying logging, it might come handy to use
zap.Log(level, ...) instead of switch or if-else if chain.

However, now I need to do a same wrapper but with Sugared logger. And
that doesn't support general Log method.

More description in #1405
@JacobOaks
Copy link
Contributor

Closing since #1406 was merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants