json_logger_formatter 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,7 +7,7 @@ module JsonLoggerFormatter
7
7
  def self.call(severity, time, progname, msg)
8
8
  line = {severity: severity, time: time, msg: msg}
9
9
  line[:progname] = progname if progname
10
- "#{line}\n"
10
+ "#{line.to_json}\n"
11
11
  end
12
12
  end
13
13
  end
@@ -1,3 +1,3 @@
1
1
  module JsonLoggerFormatter
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -10,6 +10,13 @@ describe JsonLoggerFormatter::Formatter do
10
10
  l.formatter = JsonLoggerFormatter::Formatter
11
11
  l.info({a: 'foo', b: 'bar'})
12
12
  l.error({c: 'baz', d: 'quux'})
13
- puts s.string
13
+ expected = [{"severity" => "INFO","time" => "",
14
+ "msg" => {"a" => "foo","b" => "bar"}},
15
+ {"severity" => "ERROR","time" => "",
16
+ "msg" => {"c" => "baz","d" => "quux"}}]
17
+ s.string.split("\n").map {|l| JSON.parse(l)}.zip(expected).each do |l|
18
+ l[0]["time"] = ""
19
+ expect(l[1]).to eq(l[0])
20
+ end
14
21
  end
15
22
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: json_logger_formatter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: