ruby_smart-simple_logger 1.2.0 → 1.2.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.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f93f509aad065f314393b0b7f630694091fb06c967bc20ad1fe4e0b7683f843b
|
4
|
+
data.tar.gz: 9d5a325fac9bc01ad330cec1c1c31a9bc3f5602e1934893b04ab5f3baed22ac0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5b4b91d4c70cd0e373af89191b9147739a55443e851ffdc8751e3853d833e04f59cd9aa6d125a60c752e924686a190d8bd492560860e91d18749af48adc210d4
|
7
|
+
data.tar.gz: 5cb89dd0a2cf9b77f3ce2cbc4bcf7c9f8ee218fb9030a16c9bba0259ac5ca16bf82fcdffef2602533b567b2591d94f672662a46e3562b8a1fdee398980137718
|
data/docs/CHANGELOG.md
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
# RubySmart::SimpleLogger - CHANGELOG
|
2
2
|
|
3
|
+
## [1.2.2] - 2023-03-15
|
4
|
+
* **[ref]** simplify device-generation for builtins
|
5
|
+
* **[fix]** `ActionView::Helpers::DateHelper` require, which breaks rails loading process in some cases
|
6
|
+
|
7
|
+
## [1.2.1] - 2023-02-17
|
8
|
+
* **[fix]** 'rails'-related builtins
|
9
|
+
* **[fix]** `::RubySmart::SimpleLogger::Devices::MultiDevice` register `MultiDevice` instead of nested devices
|
10
|
+
|
3
11
|
## [1.2.0] - 2023-02-16
|
4
12
|
* **[add]** multi-'builtins' support
|
5
13
|
* **[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
|
-
|
57
|
-
|
58
|
-
|
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
|
@@ -61,36 +61,30 @@ module RubySmart
|
|
61
61
|
# check for already existing +device+
|
62
62
|
return if opts[:device]
|
63
63
|
|
64
|
-
# remove builtin key from opts
|
65
|
-
|
64
|
+
# remove builtin key from opts and force an array
|
65
|
+
builtins = Array(opts.delete(:builtin))
|
66
66
|
|
67
|
-
#
|
68
|
-
|
67
|
+
# expand builtins with stdout
|
68
|
+
builtins << :stdout if opts.delete(:stdout)
|
69
69
|
|
70
|
-
# expand
|
71
|
-
if opts.delete(:
|
72
|
-
builtin = [builtin] unless builtin.is_a?(Array)
|
73
|
-
builtin << :stdout
|
74
|
-
end
|
70
|
+
# expand builtins with memory
|
71
|
+
builtins << :memory if opts.delete(:memory)
|
75
72
|
|
76
|
-
|
77
|
-
builtin = [builtin] unless builtin.is_a?(Array)
|
78
|
-
builtin << :memory
|
79
|
-
end
|
73
|
+
builtins.uniq!
|
80
74
|
|
81
|
-
#
|
82
|
-
if
|
75
|
+
# don't create multi-device for a single (or +nil+) builtin
|
76
|
+
if builtins.length < 2
|
77
|
+
opts[:device] = _resolve_device(builtins[0], opts)
|
78
|
+
else
|
83
79
|
opts[:device] = ::RubySmart::SimpleLogger::Devices::MultiDevice.new
|
84
|
-
|
80
|
+
builtins.each do |builtin|
|
85
81
|
# IMPORTANT: dup, original hash to prevent reference manipulation (on the TOP-level, only)
|
86
82
|
builtin_opts = opts.dup
|
87
|
-
opts[:device].register(_resolve_device(
|
83
|
+
opts[:device].register(_resolve_device(builtin, builtin_opts), _resolve_formatter(builtin_opts))
|
88
84
|
end
|
89
85
|
|
90
86
|
# force 'passthrough', as format, since this is required for multi-devices
|
91
87
|
opts[:format] = :passthrough
|
92
|
-
else
|
93
|
-
opts[:device] = _resolve_device(builtin, opts)
|
94
88
|
end
|
95
89
|
|
96
90
|
# prevent to return any data
|
@@ -136,7 +130,7 @@ module RubySmart
|
|
136
130
|
if ::ThreadInfo.stdout?
|
137
131
|
_resolve_device(:stdout, opts)
|
138
132
|
elsif ::ThreadInfo.rails? && ::Rails.logger
|
139
|
-
_resolve_device(:
|
133
|
+
_resolve_device(:rails, opts)
|
140
134
|
else
|
141
135
|
_resolve_device(:memory, opts)
|
142
136
|
end
|
@@ -145,7 +139,16 @@ module RubySmart
|
|
145
139
|
when :stderr
|
146
140
|
STDERR
|
147
141
|
when :rails
|
148
|
-
|
142
|
+
raise "Unable to build SimpleLogger with 'rails' builtin for not initialized rails application!" unless ThreadInfo.rails?
|
143
|
+
|
144
|
+
# special check for rails-with-console (IRB -> STDOUT) combination - mostly in combination with +Debase+.
|
145
|
+
if ThreadInfo.console? && ::Rails.logger.instance_variable_get(:@logdev).dev != STDOUT
|
146
|
+
::RubySmart::SimpleLogger::Devices::MultiDevice
|
147
|
+
.register(_resolve_device(:stdout, opts))
|
148
|
+
.register(::Rails.logger.instance_variable_get(:@logdev).dev)
|
149
|
+
else
|
150
|
+
::Rails.logger.instance_variable_get(:@logdev).dev
|
151
|
+
end
|
149
152
|
when :proc
|
150
153
|
# force overwrite opts
|
151
154
|
@ignore_payload = true
|
@@ -17,9 +17,8 @@ module RubySmart
|
|
17
17
|
end
|
18
18
|
|
19
19
|
# load date extensions for logger
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
end
|
20
|
+
# since 'actionview' is loaded in different ways, we only can check for +installed?+ here...
|
21
|
+
if GemInfo.installed?('actionview')
|
22
|
+
# IMPORTANT: any require will break the loading process
|
23
|
+
RubySmart::SimpleLogger::Logger.include(ActionView::Helpers::DateHelper) unless RubySmart::SimpleLogger::Logger.included_modules.include?(ActionView::Helpers::DateHelper)
|
25
24
|
end
|
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.
|
4
|
+
version: 1.2.2
|
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-
|
11
|
+
date: 2023-03-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ruby_smart-support
|