Fix lograge exclusion in params section

Without this fix, we would just see redundant entries in the `params` section:

```
{"method":"GET","path":"/-/metrics","format":"html","controller":"MetricsController","action":"index","status":404,"duration":1.42,"view":0.38,"db":0.0,"time":"2017-07-28T02:59:18.167Z","params":{"controller":"metrics","action":"index"}}
```

The intended format looks more like this:

```
{"method":"GET","path":"/-/metrics","format":"html","controller":"MetricsController","action":"index","status":404,"duration":76.32,"view":69.95,"db":0.0,"time":"2017-07-28T02:59:48.893Z","params":{}}
```

The proper form to exclude an array is to preface with an asterisk:
https://apidock.com/rails/Hash/except
This commit is contained in:
Stan Hu 2017-07-28 00:24:35 -05:00
parent 02b25598cb
commit 3a200165c3

View file

@ -14,7 +14,7 @@ unless Sidekiq.server?
config.lograge.custom_options = lambda do |event|
{
time: event.time.utc.iso8601(3),
params: event.payload[:params].except(%w(controller action format))
params: event.payload[:params].except(*%w(controller action format))
}
end
end