mirror of
https://github.com/imgproxy/imgproxy.git
synced 2025-01-03 10:43:58 +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:
parent
eaadb472f5
commit
cfa4b596d1
@ -434,6 +434,7 @@ imgproxy can report occurred errors to Bugsnag, Honeybadger and Sentry:
|
||||
* `pretty`: _(default)_ colored human-readable format
|
||||
* `structured`: machine-readable 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 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{})
|
||||
case "json":
|
||||
logrus.SetFormatter(&logrus.JSONFormatter{})
|
||||
case "gcp":
|
||||
logrus.SetFormatter(&logrus.JSONFormatter{
|
||||
FieldMap: logrus.FieldMap{
|
||||
"level": "severity",
|
||||
"msg": "message",
|
||||
},
|
||||
})
|
||||
default:
|
||||
logrus.SetFormatter(newPrettyFormatter())
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user