38
39
40
41
42
43
44
45
46
47
|
# File 'lib/synchrolog.rb', line 38
def call(severity, timestamp, progname, message)
anonymous_id_match = message.match(/\[synchrolog_anonymous_id:(\S*)\]/)
anonymous_id = anonymous_id_match.try(:[], 1)
msg = message.dup
msg.slice!(anonymous_id_match.begin(0)..anonymous_id_match[0].length) if anonymous_id
user_id_match = msg.match(/\[synchrolog_user_id:(\S*)\]/)
user_id = user_id_match.try(:[], 1)
msg.slice!(user_id_match.begin(0)..user_id_match[0].length) if user_id
{ type: severity, timestamp: timestamp.utc.iso8601(3), message: msg, anonymous_id: anonymous_id, user_id: user_id }
end
|