mirror of
https://github.com/imgproxy/imgproxy.git
synced 2025-02-12 11:46:10 +02:00
Add: IMGPROXY_LOG_LEVEL environment config for set Logrus debug level (#240)
This commit is contained in:
parent
1228590132
commit
e4f787e1f7
@ -222,6 +222,7 @@ imgproxy can report occurred errors to Bugsnag, Honeybadger and Sentry:
|
||||
* `pretty`: _(default)_ colored human-readable format;
|
||||
* `structured`: machine-readable format;
|
||||
* `json`: JSON format;
|
||||
* `IMGPROXY_LOG_LEVEL`: the log level. The following levels are supported `error`, `warn`, `info` and `debug`. Default: `info`;
|
||||
|
||||
imgproxy can send logs to syslog, but this feature is disabled by default. To enable it, set `IMGPROXY_SYSLOG_ENABLE` to `true`:
|
||||
|
||||
|
10
log.go
10
log.go
@ -19,7 +19,15 @@ func initLog() {
|
||||
logrus.SetFormatter(newLogPrettyFormatter())
|
||||
}
|
||||
|
||||
logrus.SetLevel(logrus.DebugLevel)
|
||||
logLevel := "info"
|
||||
strEnvConfig(&logLevel, "IMGPROXY_LOG_LEVEL")
|
||||
|
||||
levelLogLevel, err := logrus.ParseLevel(logLevel)
|
||||
if err != nil {
|
||||
levelLogLevel = logrus.DebugLevel
|
||||
}
|
||||
|
||||
logrus.SetLevel(levelLogLevel)
|
||||
|
||||
if isSyslogEnabled() {
|
||||
slHook, err := newSyslogHook()
|
||||
|
Loading…
x
Reference in New Issue
Block a user