mirror of
https://github.com/imgproxy/imgproxy.git
synced 2025-09-27 20:17:20 +02:00
feat(logger): implement structured log formatter gcp compliant (#1028)
* feat(logger): implement structured log formatter gcp compliant * docs: add new gcp logging format
This commit is contained in:
committed by
GitHub
parent
eaadb472f5
commit
cfa4b596d1
@@ -434,6 +434,7 @@ imgproxy can report occurred errors to Bugsnag, Honeybadger and Sentry:
|
|||||||
* `pretty`: _(default)_ colored human-readable format
|
* `pretty`: _(default)_ colored human-readable format
|
||||||
* `structured`: machine-readable format
|
* `structured`: machine-readable format
|
||||||
* `json`: JSON format
|
* `json`: JSON format
|
||||||
|
* `gcp`: Google Cloud Logging agent compliant
|
||||||
* `IMGPROXY_LOG_LEVEL`: the log level. The following levels are supported `error`, `warn`, `info` and `debug`. Default: `info`
|
* `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`:
|
imgproxy can send logs to syslog, but this feature is disabled by default. To enable it, set `IMGPROXY_SYSLOG_ENABLE` to `true`:
|
||||||
|
@@ -23,6 +23,13 @@ func Init() error {
|
|||||||
logrus.SetFormatter(&structuredFormatter{})
|
logrus.SetFormatter(&structuredFormatter{})
|
||||||
case "json":
|
case "json":
|
||||||
logrus.SetFormatter(&logrus.JSONFormatter{})
|
logrus.SetFormatter(&logrus.JSONFormatter{})
|
||||||
|
case "gcp":
|
||||||
|
logrus.SetFormatter(&logrus.JSONFormatter{
|
||||||
|
FieldMap: logrus.FieldMap{
|
||||||
|
"level": "severity",
|
||||||
|
"msg": "message",
|
||||||
|
},
|
||||||
|
})
|
||||||
default:
|
default:
|
||||||
logrus.SetFormatter(newPrettyFormatter())
|
logrus.SetFormatter(newPrettyFormatter())
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user