-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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 external logger support #508
base: master
Are you sure you want to change the base?
Conversation
Hello, |
The example uses Logging libraries provide a way to get an
The problem here is that the I also want to point out that other projects do this to allow for unification of logs, for example go-fiber: https://docs.gofiber.io/api/middleware/logger/ It's interesting that you say it's more about aligning APIs; but you don't realize that supporting |
Thank you for your quick reply! Do you agree that a logger created with zapLogger, _ := zap.NewDevelopment()
stdOutLogger := zap.NewStdLog(zapLogger)
zW := stdOutLogger.Writer()
logger := cron.VerbosePrintfLogger(log.New(zW, "cron: ", log.Llongfile)) would behave almost the same way as the external logger you are adding? "Almost" because of the extra call to |
You can definitely do it that way to the same affect. If that is preferred method in |
I'm not a maintainer and hence I cannot make any decision. Just wanted to share my thoughts. However, I consider very interesting what you pointed out and maybe this could lead to some discussion for a potential logging API refactor proposal. |
Refactor is probably overkill for something like this, especially with projects that use this library. That's why this PR adds additional functionality instead of removing/changing the old. |
Hello,
This PR adds support for external loggers via
io.Writer
. Sample code of it working is below:Should output something like: