ruby_smart-simple_logger 1.2.0 → 1.2.1

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
  SHA256:
3
- metadata.gz: a47086748b62315efd5a4497e118bbb8a537cb153099cefa99e9432a8ed14ecb
4
- data.tar.gz: 9f74e2177dfd4fb008fb8b203d282217a37846c724b4e2b0bfa55ae982ea83ef
3
+ metadata.gz: d4f5d3ae3592f31b6c012044205c37d859c9e809d58f8cce63c7b6b2ed634829
4
+ data.tar.gz: d50becd65a8386e2466ddebcbbbd6bf2ec92aad95f4c5ae76288974429d607bc
5
5
  SHA512:
6
- metadata.gz: 50d2cb4beda62d0c4189c22eb201ae8cc95e1cf6d9e0f037522f58c27ce3ddf34a000fba9156a71b662b223313fe2cdd4d5589916094cbe19b71393220e62464
7
- data.tar.gz: 723da7c50cc2d87ea2c8de011c0f54d743c32c5abf99da5441a5cf6a6cec7657ec4dd35de3d67ab6d3cc9ed8b95db01c0ef702a20a6d33b8a25d1f1ba7ab34dc
6
+ metadata.gz: dbe6aab96f5a2f67f85fd5147462d65e0f8496a1271406710f4d9e8b5df3a245c8f7e1292a9ac3f548973a204442332abafe21a8a97b6724f25a513b3eef7148
7
+ data.tar.gz: 5165beba92525197a3d9359bc7513c15e4aa6057a3bea5902870541141fe9ca4fdb3b4f6270eefcbbbf7ca75aff209e03cf39d4d8eb00d34e3292a45e71960ad
data/docs/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # RubySmart::SimpleLogger - CHANGELOG
2
2
 
3
+ ## [1.2.1] - 2023-02-17
4
+ * **[fix]** 'rails'-related builtins
5
+ * **[fix]** `::RubySmart::SimpleLogger::Devices::MultiDevice` register `MultiDevice` instead of nested devices
6
+
3
7
  ## [1.2.0] - 2023-02-16
4
8
  * **[add]** multi-'builtins' support
5
9
  * **[ref]** `Logger` initialization - now supports to provide multiple builtins
@@ -53,10 +53,15 @@ module RubySmart
53
53
  #
54
54
  # @param [Object] dev
55
55
  def register(dev, formatter = nil)
56
- @devices << {
57
- dev: dev,
58
- formatter: formatter
59
- }
56
+ # check device, to prevent nested sets of +MultiDevice+
57
+ if dev.is_a?(MultiDevice)
58
+ @devices += dev.devices
59
+ else
60
+ @devices << {
61
+ dev: dev,
62
+ formatter: formatter
63
+ }
64
+ end
60
65
 
61
66
  self
62
67
  end
@@ -136,7 +136,7 @@ module RubySmart
136
136
  if ::ThreadInfo.stdout?
137
137
  _resolve_device(:stdout, opts)
138
138
  elsif ::ThreadInfo.rails? && ::Rails.logger
139
- _resolve_device(:stdout, opts)
139
+ _resolve_device(:rails, opts)
140
140
  else
141
141
  _resolve_device(:memory, opts)
142
142
  end
@@ -145,7 +145,16 @@ module RubySmart
145
145
  when :stderr
146
146
  STDERR
147
147
  when :rails
148
- ::Rails.logger.instance_variable_get(:@logdev).dev
148
+ raise "Unable to build SimpleLogger with 'rails' builtin for not initialized rails application!" unless ThreadInfo.rails?
149
+
150
+ # special check for rails-with-console (IRB -> STDOUT) combination - mostly in combination with +Debase+.
151
+ if ThreadInfo.console? && ::Rails.logger.instance_variable_get(:@logdev).dev != STDOUT
152
+ ::RubySmart::SimpleLogger::Devices::MultiDevice
153
+ .register(_resolve_device(:stdout, opts))
154
+ .register(::Rails.logger.instance_variable_get(:@logdev).dev)
155
+ else
156
+ ::Rails.logger.instance_variable_get(:@logdev).dev
157
+ end
149
158
  when :proc
150
159
  # force overwrite opts
151
160
  @ignore_payload = true
@@ -10,7 +10,7 @@ module RubySmart
10
10
  module VERSION
11
11
  MAJOR = 1
12
12
  MINOR = 2
13
- TINY = 0
13
+ TINY = 1
14
14
  PRE = nil
15
15
 
16
16
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_smart-simple_logger
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tobias Gonsior
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-02-16 00:00:00.000000000 Z
11
+ date: 2023-02-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ruby_smart-support