asenchi / scrolls

Simple logging
MIT License
158 stars 26 forks source link

Fix odd time behavior #49

Closed asenchi closed 10 years ago

asenchi commented 10 years ago

With the advent of #48, timestamps in the ISO8601 format (or any value containing a ":") are now quoted. However, Scrolls own behavior of adding a timestamp with Scrolls.add_timestamp = true circumvented this behavior. Example:

Given this code (and some debug output in scrolls):

Scrolls.log(:now => Time.now.iso8601, :timestamp => "f")
Scrolls.add_timestamp = true
Scrolls.log(:timestamp => "t")

Before this PR:

projects/testscrolls : ./test.rb
{:now=>"2014-01-17T00:49:14-05:00", :timestamp=>"f"}
now="2014-01-17T00:49:14-05:00" timestamp=f
{:now=>2014-01-17 05:49:14 UTC, :timestamp=>"t"}
now=2014-01-17T05:49:14Z timestamp=t

After the changes here:

projects/testscrolls : ./test.rb
{:now=>"2014-01-17T00:50:18-05:00", :timestamp=>"f"}
now="2014-01-17T00:50:18-05:00" timestamp=f
{:now=>2014-01-17 05:50:18 UTC, :timestamp=>"t"}
now="2014-01-17T05:50:18Z" timestamp=t