ougai 1.9.1-java → 2.1.0-java

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0ae6d84b8f46bc06fde403b3e4952ddc21a3370c10381b47495468ad6155cf27
4
- data.tar.gz: 44214cb40f7eeb084b5fb29b68ddb27fd2d0d3d9007b85d4f3de08a7b4442fe9
3
+ metadata.gz: f6f4e99226326c7076a1297c07e51f19722d73481f9ab9fa2e4d046a8d615ec7
4
+ data.tar.gz: 143e18dede3293499083e217d36dd26c153a363abf8cf431fa7241e38e64d775
5
5
  SHA512:
6
- metadata.gz: 96d8cccd04b2ee45766f0474971198d201e8e74077d6f2ca2072186415d2ea851f92f0b2a75efc7b39ee2dea228feeddf8e822aea32b765f867fc38f8803e584
7
- data.tar.gz: 757a08c82faf06941b0e1bfacf8908e51bbd8dbd468d55f2e64a8d55f4b127e4bd152175367e700577aa734cc908c75a05e14fca082d7190aa795ed6f978158d
6
+ metadata.gz: 99699d2fa46285cc2c22a7cf573cdba0da0097f089aab051dbb87a6bb50f1ff9d42be36767e1d023ed259cdf6224fd8064af31e0efc0fafe22b5d007751beef3
7
+ data.tar.gz: bb92aa7447bd94a71b8222876401bf7063e116dbbc3c9f462130147b56528761962c87dec6472a12d6a4af3a4edb344b9d10b7543034342b0f2de3624122c44e
data/Gemfile CHANGED
@@ -5,6 +5,8 @@ gemspec
5
5
 
6
6
  group :test do
7
7
  gem 'amazing_print'
8
+ gem 'rake', '~> 13.2'
9
+ gem 'rspec', '~> 3.13'
8
10
  gem 'simplecov', '< 0.18', require: false
9
11
  gem 'timecop'
10
12
  gem 'yard'
data/Gemfile.lock CHANGED
@@ -1,52 +1,56 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ougai (1.9.1-java)
5
- jrjackson (~> 0.4)
4
+ ougai (2.1.0)
5
+ logger (~> 1.5)
6
+ oj (~> 3.17)
6
7
 
7
8
  GEM
8
9
  remote: https://rubygems.org/
9
10
  specs:
10
- amazing_print (1.2.2)
11
- diff-lcs (1.4.4)
12
- docile (1.3.0)
13
- jrjackson (0.4.13-java)
14
- json (2.1.0-java)
15
- rake (13.0.3)
16
- rspec (3.10.0)
17
- rspec-core (~> 3.10.0)
18
- rspec-expectations (~> 3.10.0)
19
- rspec-mocks (~> 3.10.0)
20
- rspec-core (3.10.1)
21
- rspec-support (~> 3.10.0)
22
- rspec-expectations (3.10.1)
11
+ amazing_print (2.0.0)
12
+ bigdecimal (4.1.2)
13
+ diff-lcs (1.6.2)
14
+ docile (1.4.1)
15
+ json (2.20.0)
16
+ logger (1.7.0)
17
+ oj (3.17.3)
18
+ bigdecimal (>= 3.0)
19
+ ostruct (>= 0.2)
20
+ ostruct (0.6.3)
21
+ rake (13.4.2)
22
+ rspec (3.13.2)
23
+ rspec-core (~> 3.13.0)
24
+ rspec-expectations (~> 3.13.0)
25
+ rspec-mocks (~> 3.13.0)
26
+ rspec-core (3.13.6)
27
+ rspec-support (~> 3.13.0)
28
+ rspec-expectations (3.13.5)
23
29
  diff-lcs (>= 1.2.0, < 2.0)
24
- rspec-support (~> 3.10.0)
25
- rspec-mocks (3.10.1)
30
+ rspec-support (~> 3.13.0)
31
+ rspec-mocks (3.13.8)
26
32
  diff-lcs (>= 1.2.0, < 2.0)
27
- rspec-support (~> 3.10.0)
28
- rspec-support (3.10.1)
29
- simplecov (0.16.1)
33
+ rspec-support (~> 3.13.0)
34
+ rspec-support (3.13.7)
35
+ simplecov (0.17.1)
30
36
  docile (~> 1.1)
31
37
  json (>= 1.8, < 3)
32
38
  simplecov-html (~> 0.10.0)
33
39
  simplecov-html (0.10.2)
34
- timecop (0.9.1)
35
- yard (0.9.12)
40
+ timecop (0.9.11)
41
+ yard (0.9.44)
36
42
 
37
43
  PLATFORMS
38
- java
39
- universal-java-15
44
+ x86_64-linux
40
45
 
41
46
  DEPENDENCIES
42
47
  amazing_print
43
- bundler (>= 2.1.4)
44
48
  ougai!
45
- rake (>= 13.0.1)
46
- rspec (>= 3.9.0)
49
+ rake (~> 13.2)
50
+ rspec (~> 3.13)
47
51
  simplecov (< 0.18)
48
52
  timecop
49
53
  yard
50
54
 
51
55
  BUNDLED WITH
52
- 2.2.4
56
+ 2.3.3
data/LICENSE.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2016-2020 Toshimitsu Takahashi
3
+ Copyright (c) 2016-2026 Toshimitsu Takahashi
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -2,14 +2,12 @@ Ougai
2
2
  =====
3
3
 
4
4
  [![Gem Version](https://badge.fury.io/rb/ougai.svg)](https://badge.fury.io/rb/ougai)
5
- [![document](https://img.shields.io/badge/document-1.9.1-green.svg)](http://www.rubydoc.info/gems/ougai/)
6
- [![Build Status](https://travis-ci.org/tilfin/ougai.svg?branch=master)](https://travis-ci.org/tilfin/ougai)
7
- [![Code Climate](https://codeclimate.com/github/tilfin/ougai/badges/gpa.svg)](https://codeclimate.com/github/tilfin/ougai)
8
- [![Test Coverage](https://codeclimate.com/github/tilfin/ougai/badges/coverage.svg)](https://codeclimate.com/github/tilfin/ougai/coverage)
5
+ [![document](https://img.shields.io/badge/document-2.1.0-green.svg)](http://www.rubydoc.info/gems/ougai/)
6
+ [![CI](https://github.com/tilfin/ougai/actions/workflows/ci.yml/badge.svg)](https://github.com/tilfin/ougai/actions/workflows/ci.yml)
9
7
 
10
- A structured logging system is capable of handling a message, structured data or an exception easily.
11
- It has JSON formatters compatible with [Bunyan](https://github.com/trentm/node-bunyan) or [pino](https://github.com/pinojs/pino) for Node.js and
12
- human readable formatter with [Amazing Print](https://github.com/amazing-print/amazing_print) for console.
8
+ A structured logging system that is capable of handling a message, structured data, or an exception easily.
9
+ It has JSON formatters compatible with [Bunyan](https://github.com/trentm/node-bunyan) or [pino](https://github.com/pinojs/pino) for Node.js, and a
10
+ human-readable formatter with [Amazing Print](https://github.com/amazing-print/amazing_print) for the console.
13
11
 
14
12
  ## Installation
15
13
 
@@ -33,14 +31,13 @@ $ gem install ougai
33
31
 
34
32
  ## Usage
35
33
 
36
- **Ougai::Logger** is sub-class of original [Logger](https://ruby-doc.org/stdlib-2.4.1/libdoc/logger/rdoc/Logger.html) in Ruby.
37
- All arguments of the `initialize` pass through itself to **::Logger**.
34
+ **Ougai::Logger** is a sub-class of the standard [Logger](https://ruby-doc.org/stdlib-2.4.1/libdoc/logger/rdoc/Logger.html) in Ruby.
35
+ All arguments of the `initialize` pass through to **::Logger**.
38
36
 
39
37
  ```ruby
40
- require 'rubygems'
41
38
  require 'ougai'
42
39
 
43
- logger = Ougai::Logger.new(STDOUT)
40
+ logger = Ougai::Logger.new($stdout)
44
41
  ```
45
42
 
46
43
  ### TRACE level
@@ -176,7 +173,7 @@ logger.fatal do
176
173
  end
177
174
  ```
178
175
 
179
- To specify more than one of a message, an exception and custom data, the block returns them as an array.
176
+ To specify more than one message, exception, and custom data, the block returns them as an array.
180
177
 
181
178
  ### Adding custom fields to all logs
182
179
 
@@ -194,7 +191,18 @@ logger.info('Hello!', user: { name: 'Jiro' }, version: '2.3')
194
191
  ```
195
192
 
196
193
  If any field of with_fields is specified in each log, the field is overridden.
197
- But if the field's type is *Array*, both with_field value and logging value are merged with `concat` and `uniq`.
194
+ If the field's type is *Array*, both with_field value and logging value are merged with `concat` and `uniq`.
195
+
196
+ If the field's type is *Hash*, then values are merged recursively.
197
+
198
+ ```ruby
199
+ logger.with_fields = { version: '1.1.0', user: { name: 'Taro' } }
200
+ logger.debug(user: { age: 19 })
201
+ ```
202
+
203
+ ```json
204
+ {"name":"test","hostname":"mint","pid":30182,"level":20,"time":"2017-07-22T20:52:12.332+09:00","v":0,"version":"1.1.0","msg":"No message","user":{"name":"Taro","age":19}}
205
+ ```
198
206
 
199
207
  ### Create a child logger
200
208
 
@@ -242,6 +250,8 @@ child_logger.debug('This is not outputted')
242
250
 
243
251
  If any field exists in both parent log and child log, the parent value is overridden or merged by child value.
244
252
 
253
+ If the field's type is *Hash*, then values are merged recursively.
254
+
245
255
  ### Hook before logging
246
256
 
247
257
  Setting `before_log` of logger or child an *lambda* with `data` field, a process can be run before log each output.
@@ -344,7 +354,6 @@ gem 'amazing_print'
344
354
  Set *Ougai::Formatters::Readable* instance to `formatter` accessor
345
355
 
346
356
  ```ruby
347
- require 'rubygems'
348
357
  require 'ougai'
349
358
 
350
359
  logger = Ougai::Logger.new(STDOUT)
@@ -353,7 +362,7 @@ logger.formatter = Ougai::Formatters::Readable.new
353
362
 
354
363
  ### Screen result example
355
364
 
356
- ![Screen Shot](https://github.com/tilfin/ougai/blob/images/ougai_readable_format.png?raw=true)
365
+ ![Screen Shot](https://github.com/tilfin/ougai/blob/images/ougai_readable_format_2-1.png?raw=true)
357
366
 
358
367
 
359
368
  ## How to use with famous products, services and libraries
data/lib/ougai/logging.rb CHANGED
@@ -120,6 +120,8 @@ module Ougai
120
120
  base_data.merge!(inferior_data) do |_, base_v, inferior_v|
121
121
  if base_v.is_a?(Array) and inferior_v.is_a?(Array)
122
122
  (inferior_v + base_v).uniq
123
+ elsif base_v.is_a?(Hash) and inferior_v.is_a?(Hash)
124
+ weak_merge!(base_v, inferior_v)
123
125
  else
124
126
  base_v
125
127
  end
data/lib/ougai/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Ougai
4
- VERSION = '1.9.1'
4
+ VERSION = '2.1.0'
5
5
  end
metadata CHANGED
@@ -1,71 +1,42 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ougai
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.1
4
+ version: 2.1.0
5
5
  platform: java
6
6
  authors:
7
7
  - Toshimitsu Takahashi
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2021-01-15 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
13
+ name: logger
14
14
  requirement: !ruby/object:Gem::Requirement
15
15
  requirements:
16
16
  - - "~>"
17
17
  - !ruby/object:Gem::Version
18
- version: '0.4'
19
- name: jrjackson
18
+ version: '1.5'
20
19
  type: :runtime
21
20
  prerelease: false
22
21
  version_requirements: !ruby/object:Gem::Requirement
23
22
  requirements:
24
23
  - - "~>"
25
24
  - !ruby/object:Gem::Version
26
- version: '0.4'
27
- - !ruby/object:Gem::Dependency
28
- requirement: !ruby/object:Gem::Requirement
29
- requirements:
30
- - - ">="
31
- - !ruby/object:Gem::Version
32
- version: 2.1.4
33
- name: bundler
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ">="
39
- - !ruby/object:Gem::Version
40
- version: 2.1.4
41
- - !ruby/object:Gem::Dependency
42
- requirement: !ruby/object:Gem::Requirement
43
- requirements:
44
- - - ">="
45
- - !ruby/object:Gem::Version
46
- version: 13.0.1
47
- name: rake
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - ">="
53
- - !ruby/object:Gem::Version
54
- version: 13.0.1
25
+ version: '1.5'
55
26
  - !ruby/object:Gem::Dependency
27
+ name: jrjackson
56
28
  requirement: !ruby/object:Gem::Requirement
57
29
  requirements:
58
- - - ">="
30
+ - - "~>"
59
31
  - !ruby/object:Gem::Version
60
- version: 3.9.0
61
- name: rspec
62
- type: :development
32
+ version: '0.4'
33
+ type: :runtime
63
34
  prerelease: false
64
35
  version_requirements: !ruby/object:Gem::Requirement
65
36
  requirements:
66
- - - ">="
37
+ - - "~>"
67
38
  - !ruby/object:Gem::Version
68
- version: 3.9.0
39
+ version: '0.4'
69
40
  description: |2
70
41
  A structured logging system is capable of handling a message, custom data or an exception easily.
71
42
  It has JSON formatters compatible with Bunyan or pino for Node.js and human readable formatter with Amazing Print for console.
@@ -93,20 +64,10 @@ files:
93
64
  - lib/ougai/serializers/json_jr_jackson.rb
94
65
  - lib/ougai/serializers/json_oj.rb
95
66
  - lib/ougai/version.rb
96
- - spec/child_logger_spec.rb
97
- - spec/formatters/base_spec.rb
98
- - spec/formatters/bunyan_spec.rb
99
- - spec/formatters/pino_spec.rb
100
- - spec/formatters/readable_spec.rb
101
- - spec/logger_spec.rb
102
- - spec/logging_spec.rb
103
- - spec/ougai_spec.rb
104
- - spec/spec_helper.rb
105
67
  homepage: https://github.com/tilfin/ougai
106
68
  licenses:
107
69
  - MIT
108
70
  metadata: {}
109
- post_install_message:
110
71
  rdoc_options: []
111
72
  require_paths:
112
73
  - lib
@@ -114,25 +75,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
114
75
  requirements:
115
76
  - - ">="
116
77
  - !ruby/object:Gem::Version
117
- version: 2.5.0
78
+ version: 3.1.0
118
79
  required_rubygems_version: !ruby/object:Gem::Requirement
119
80
  requirements:
120
81
  - - ">="
121
82
  - !ruby/object:Gem::Version
122
83
  version: '0'
123
84
  requirements: []
124
- rubygems_version: 3.0.6
125
- signing_key:
85
+ rubygems_version: 4.0.3
126
86
  specification_version: 4
127
87
  summary: JSON logger compatible with node-bunyan or pino is capable of handling structured
128
88
  data easily.
129
- test_files:
130
- - spec/child_logger_spec.rb
131
- - spec/logging_spec.rb
132
- - spec/ougai_spec.rb
133
- - spec/spec_helper.rb
134
- - spec/logger_spec.rb
135
- - spec/formatters/pino_spec.rb
136
- - spec/formatters/readable_spec.rb
137
- - spec/formatters/base_spec.rb
138
- - spec/formatters/bunyan_spec.rb
89
+ test_files: []