caddyserver / certmagic

Automatic HTTPS for any Go program: fully-managed TLS certificate issuance and renewal
https://pkg.go.dev/github.com/caddyserver/certmagic?tab=doc
Apache License 2.0
5k stars 289 forks source link

How to disable logs? #285

Closed anderspitman closed 5 months ago

anderspitman commented 5 months ago

What is your question?

I'm building a TUI app that uses certmagic. I'm getting logs like this: 1.7145766424722135e+09 info maintenance started background certificate maintenance {"cache": "0xc000240d80"}

I need to turn them off because they're interfering with the TUI.

What have you already tried?

I've tried setting os.Stdout and os.Stderr to files. Also tried certmagic.DefaultACME.Logger = nil certmagic.Default.Logger = nil

Bonus: What do you use this package for, and does it help you?

Pretty much everywhere I need TLS. It's awesome and so are you.

anderspitman commented 5 months ago

After reading the docs more closely, this appears to be working:

certmagic.Default.Logger = zap.NewNop()

Sorry and thanks!