mirror of
https://github.com/meineerde/rackstash.git
synced 2026-01-31 17:27:13 +00:00
Use a plain optional argument for normalize_timestamp
This commit is contained in:
parent
1552728971
commit
969e1e8cf3
@ -28,7 +28,7 @@ module Rackstash
|
||||
# hash. By default, we use the `"@timestamp"` field.
|
||||
# @return [Hash] the given event with the `field` key set as an ISO 8601
|
||||
# formatted time string.
|
||||
def normalize_timestamp(event, field: FIELD_TIMESTAMP) #:doc:
|
||||
def normalize_timestamp(event, field = FIELD_TIMESTAMP) #:doc:
|
||||
time = event[field]
|
||||
|
||||
if time.is_a?(Time) || time.is_a?(DateTime)
|
||||
|
||||
@ -53,7 +53,7 @@ describe Rackstash::Encoder::Helper::Timestamp do
|
||||
event['@timestamp'] = Time.parse('2016-10-17 13:37:00 +03:00')
|
||||
event['custom'] = Time.parse('2016-10-17 20:42:00 +07:00')
|
||||
|
||||
expect(helper.normalize_timestamp(event, field: 'custom')).to match(
|
||||
expect(helper.normalize_timestamp(event, 'custom')).to match(
|
||||
'@timestamp' => instance_of(Time),
|
||||
'custom' => '2016-10-17T13:42:00.000000Z'
|
||||
)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user