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

can I replace the log package with zap? #75

Open
wuzhican opened this issue Sep 19, 2023 · 2 comments
Open

can I replace the log package with zap? #75

wuzhican opened this issue Sep 19, 2023 · 2 comments

Comments

@wuzhican
Copy link

I use the zap to take over the gin logger and other package's log.it'sI use zap to take over the log output of the package in the project, and I also want to take over the log of gin-oauth2 using zap, is there any solution?

@szuecs
Copy link
Member

szuecs commented Sep 19, 2023

@wuzhican right now there is no solution for this. I think what we can do is to use a minimal log interface such that it would satisfy the requirement of the library. In this case I would hop that basically any logger could be able to use.

Do you want to propose a PR?

@janhoon
Copy link
Contributor

janhoon commented Oct 26, 2024

This still open for contribution? Would really like to log in JSON. and with a minimal interface for let's say info(), error() and warn()

if custom logger is used, it will replace calls in ginoauth2.go

func errorf(f string, args ...interface{}) {
	logf(glog.Errorf, f, args...)
}

func infof(f string, args ...interface{}) {
	logf(glog.Infof, f, args...)
}

func infofv2(f string, args ...interface{}) {
	logf(glog.V(2).Infof, f, args...)
}

with the LoggerInterface.info() or LoggerInterface.error()

will submit a PR with proposal

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

No branches or pull requests

3 participants