sirupsen / logrus

Structured, pluggable logging for Go.
MIT License
24.8k stars 2.27k forks source link

Provide a http.Handler, http.HandlerFunc to alter log level during runtime #1365

Closed tedli closed 1 year ago

tedli commented 1 year ago

The user program can implement such logic independently, but a bundled one could be convenient. And share a common API.

Then the user program can serve this handler like the pprof, promhttp.Handler do.

If so, we could run with info or warning level in production, and turn to debug if something goes wrong. Something like:

curl -XPOST 127.0.0.1:8080/logging -d '{"level":"debug"}'

We can also do some more with Fields, turning log level to debug only if the log entry has specific fields.

tedli commented 1 year ago

If it's a common needs, I'm glad to work on this.

github-actions[bot] commented 1 year ago

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] commented 1 year ago

This issue was closed because it has been inactive for 14 days since being marked as stale.