1
0
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:
William Pain 2019-11-21 12:16:12 +01:00 committed by Sergey Alexandrovich
parent 1228590132
commit e4f787e1f7
2 changed files with 10 additions and 1 deletions

View File

@ -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
View File

@ -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()