ougai 1.5.7 → 1.5.8

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: ceb8c682480975c5a3f5ab0da5f8336ad340d2f7
4
- data.tar.gz: a23137a6d8297fb787a6b0c9b3ec50c2630d04d2
3
+ metadata.gz: a588e40241e44170e894aae8b996ccc82375645f
4
+ data.tar.gz: aca283dc2cd06a235d18ac64c3e837fbd11067e3
5
5
  SHA512:
6
- metadata.gz: 41fd722562d4e09300b5048b7c74f540e4d54486f83e95fd722c16eb78e20334e3976e5441c63ae3d93c46508d5db81bcf06b867734b1d0b8cd6e4046e28d127
7
- data.tar.gz: eedadc34fdae3207aceb6fb1aea85e3458e5d1fae44cb09da2117e8092289dcd89ab786ba0654c8bf0d5b607b08186ac21ce11b77e1dfb72f7d8d7ee1b78598f
6
+ metadata.gz: 6fc74083126a0500526eaad7cee67ffc1b6a8819a547d3b30239f01f0a49f1333ffb9405cea7c68cd2ef606a0d0853613c159382f2b8cb08120a1465e09b3e73
7
+ data.tar.gz: ab58e1af3d71ffa0f2ae74f3fc976a1487f4785c8e5858cca19b835b600fe8a4c47b9b2b64a076d090393e40b6b6a0ba392f9e1f67bf70aa2dd9e48c114c9384
@@ -4,6 +4,7 @@ require 'socket'
4
4
  module Ougai
5
5
  module Formatters
6
6
  # Base formatter
7
+ # Custom formatter must override `_call`.
7
8
  # @attr [Fixnum] trace_indent Specify exception backtrace indent (by default this is 2).
8
9
  # @attr [Fixnum] trace_max_lines Keep exception backtrace lines (by default this is 100).
9
10
  # @attr [Boolean] serialize_backtrace Whether exception should converts String (by default this is on).
@@ -21,6 +22,14 @@ module Ougai
21
22
  self.datetime_format = nil
22
23
  end
23
24
 
25
+ def call(severity, time, progname, data)
26
+ _call(severity, time, progname, data.is_a?(Hash) ? data : { msg: data.to_s })
27
+ end
28
+
29
+ def _call(severity, time, progname, data)
30
+ raise NotImplementedError, "_call must be implemented"
31
+ end
32
+
24
33
  def datetime_format=(value)
25
34
  @datetime_format = value || default_datetime_format
26
35
  end
@@ -15,7 +15,7 @@ module Ougai
15
15
  @with_newline = true
16
16
  end
17
17
 
18
- def call(severity, time, progname, data)
18
+ def _call(severity, time, progname, data)
19
19
  dump({
20
20
  name: progname || @app_name,
21
21
  hostname: @hostname,
@@ -18,7 +18,7 @@ module Ougai
18
18
  load_dependent
19
19
  end
20
20
 
21
- def call(severity, time, progname, data)
21
+ def _call(severity, time, progname, data)
22
22
  msg = data.delete(:msg)
23
23
  level = @plain ? severity : colored_level(severity)
24
24
  dt = format_datetime(time)
@@ -1,3 +1,3 @@
1
1
  module Ougai
2
- VERSION = "1.5.7"
2
+ VERSION = "1.5.8"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ougai
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.7
4
+ version: 1.5.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Toshimitsu Takahashi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-12-17 00:00:00.000000000 Z
11
+ date: 2017-12-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -103,17 +103,17 @@ required_rubygems_version: !ruby/object:Gem::Requirement
103
103
  version: '0'
104
104
  requirements: []
105
105
  rubyforge_project:
106
- rubygems_version: 2.6.13
106
+ rubygems_version: 2.6.11
107
107
  signing_key:
108
108
  specification_version: 4
109
109
  summary: JSON logger compatible with node-bunyan is capable of handling structured
110
110
  data easily.
111
111
  test_files:
112
- - spec/formatters/base_spec.rb
113
- - spec/formatters/bunyan_spec.rb
114
- - spec/formatters/readable_spec.rb
112
+ - spec/spec_helper.rb
115
113
  - spec/child_logger_spec.rb
116
- - spec/logging_spec.rb
117
114
  - spec/logger_spec.rb
118
115
  - spec/ougai_spec.rb
119
- - spec/spec_helper.rb
116
+ - spec/formatters/readable_spec.rb
117
+ - spec/formatters/bunyan_spec.rb
118
+ - spec/formatters/base_spec.rb
119
+ - spec/logging_spec.rb