rt-logman 1.2.0 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cc85961093fc227f2cfff8571bd009840407a1d2
4
- data.tar.gz: 4d5d185920f6d15bd3cc7d863d1d1d3aae20a748
3
+ metadata.gz: 3a98a531ba1b21899c6947970888715617f6d70f
4
+ data.tar.gz: fec8d1f4f2428bbc744f00f57a462b098bfdb22e
5
5
  SHA512:
6
- metadata.gz: 0b03e92623808049925fafd3a353fe8bc4574401489105a1d7af1203417c8e6b2962b2b052b777cc0ef6ac32f10d6f06127fac07eb18813d097552e45eea961b
7
- data.tar.gz: aa14f92a9a4c7d07865ed318bf89e27dc0dfba0ff9e0ccdfed58adb44f304a31affc0b7074c302bbf07347cac37fea7770204d5c7d70ad0e2ff7acad95d481db
6
+ metadata.gz: 8f9caae8bc668a56c413b4612f889a2b752d57c1163f682610bb5e66c1f5cc933abb01da95af7a5f05b36db367d0462a66914c0aa86ba2b7e9f54dc69f2eb752
7
+ data.tar.gz: c7a47680c2c7e24fdce6b4d961cd35d9a2a68c2ab01843fb6b86f58f0384f397ddf545927099b2485fda1320a5cd58db903b3c989de272270f366f4f3df5e3c8
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rt-logman (1.2.0)
4
+ rt-logman (1.3.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -74,15 +74,28 @@ class Logman
74
74
  private
75
75
 
76
76
  def log(level, message, metadata = {})
77
- meta = @fields.merge(metadata).map { |key, val| "#{key}: '#{val}'" }.join(", ")
78
-
79
- @logger.public_send(level, "#{message} -- #{meta}")
77
+ @logger.public_send(level, { :msg => message }.merge(@fields).merge(metadata))
80
78
  end
81
79
 
82
80
  def formatter
83
81
  proc do |severity, datetime, _progname, msg|
84
- "#{severity.upcase} [#{datetime.strftime("%H:%M:%S.%3N")} ##{Process.pid}] -- #{msg}\n"
82
+ event = {
83
+ :level => severity.upcase,
84
+ :time => datetime,
85
+ :pid => Process.pid
86
+ }
87
+
88
+ if msg.is_a?(Hash)
89
+ event.merge!(msg)
90
+ else
91
+ event[:msg] = msg.to_s
92
+ end
93
+
94
+ "#{format(event)}\n"
85
95
  end
86
96
  end
87
97
 
98
+ def format(event_hash)
99
+ event_hash.to_json
100
+ end
88
101
  end
@@ -1,3 +1,3 @@
1
1
  class Logman
2
- VERSION = "1.2.0".freeze
2
+ VERSION = "1.3.0".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rt-logman
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rendered Text
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-03-16 00:00:00.000000000 Z
11
+ date: 2018-03-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler