epimorphics / json-rails-logger

A custom rails logger that outputs JSON instead of raw text
MIT License
1 stars 1 forks source link

Timestamp Changes #21

Closed bogdanadrianmarc closed 3 years ago

bogdanadrianmarc commented 3 years ago

This PR addresses issue #20 . It changes timestamp format to include milliseconds and timezone, and renames field name from timestamp to ts in returning JSON

andrew-pickin-epi commented 3 years ago

I don't believe these changes match the requested format. for n=3 Implemented %Y-%m-%d %H:%M:%S.%3N %Z requested %Y-%m-%dT%H:%M:%S.%3NZ Further, is the code assuming the time is GMT?

bogdanadrianmarc commented 3 years ago

Is there an assumption here that the time will already be in UTC? Are we content with that?

The time will be in whatever timezone the machine the app is running on is, so if the machine's timezone is GMT the timestamps will always be in GMT. Is this ok with you @andrew-pickin-epi ?

ijdickinson commented 3 years ago

@bogdanadrianmarc @andrew-pickin-epi We can coerce a Ruby DateTime to UTC with the .utc method. So we could ensure that all timestamps are UTC by:

def process_timestamp(timestamp)
  format_datetime(timestamp.utc)
end

I guess the question is: what should be the desired behaviour when a log message is emitted during BST?