ruby_smart-simple_logger 1.5.3 → 1.6.0

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: cc624589a3aa7114bbec118563f3f802b046032abe1df2fbddf762971b99bf12
4
- data.tar.gz: 94a9de8091320a9d5395878e1a22362e2ae15d0be0e497f2a6ff3d9f22eeddd4
3
+ metadata.gz: 5f377784d8f7f47e7e2e6e8db6af4a59f18141a46dc4a02c6a1e7d065b40d660
4
+ data.tar.gz: 23bceaf895ef087fb54620a3b8b09c8c1952da685ce862c8eaafff52bf7756fa
5
5
  SHA512:
6
- metadata.gz: 7a80eff8cd646906a76abab041aa884fe769a4707e8b9ba7d819707664b71352108f1116eb5530711925bf6d1bc7eac104f5a2086bd050db41177e56d32f0874
7
- data.tar.gz: 92c98897175040fc149e8825db0d1f941197b0aa301ea025731f38fb79a70ac09eff6833ebd622030167c2d530cf9db2dd7b5a9feaaf2ee5838561a9297ff991
6
+ metadata.gz: 2c1de42c4b096d61f6c9e085c613cb3d70f82c6aae3abdb4d2f4e488d4eb665576a37d68b22d23fb57d15d6bebbe4231f533c34b12e1e3a079ccb4d6f540acb2
7
+ data.tar.gz: e6eef91be3f2e57d15401b9ae6d4768265376957009b3934122d21456b7ad16c1c2322b35aa12b658af027e6407c252a5e5d49cf745ed32a995e28ab78b97b76
data/README.md CHANGED
@@ -39,6 +39,7 @@ Or install it yourself as:
39
39
  * `awesome_print` gem compatibility for a prettified object debug
40
40
  * Multi-device support (write to logfile & to STDOUT & to ... & to ...)
41
41
  * 'klass_logger' instances for easier access _(see [klass_logger](#klass_logger_Usage))_
42
+ * Debug / Debase compatibility
42
43
 
43
44
  -----
44
45
 
@@ -789,12 +790,89 @@ end
789
790
  # ╚ END ❯ Process Alpha (0.001036969)
790
791
  ```
791
792
 
792
- ### _other useful methods_
793
+ ### model(mdl, opts)
794
+ Useful for rails applications to debug or log a save _(create/update)_ result of a model.
795
+ The `model` method logs in three different scenes `SUCCESS ERROR INFO`, depending on the models state: created, updated, error, skipped
793
796
 
794
- - line
795
- - print
796
- - nl
797
- - model _(rails only)_
797
+ ```ruby
798
+ require 'simple_logger'
799
+ l = SimpleLogger.new(:stdout, payload: false)
800
+
801
+ # create a model and save it (with validation errors)
802
+ mdl = User.new first_name: 'Max'
803
+ mdl.save
804
+
805
+ # log the result
806
+ l.model(mdl)
807
+
808
+ # creates an ERROR of:
809
+ # [USER|ERROR] Max (E-Mail is invalid, Username is invalid)
810
+
811
+ # ------------------------------------------------------------------------------------------
812
+
813
+ # update the model to prevent validation errors
814
+ mdl.username = 'test'
815
+ mdl.email = 'max@test.x'
816
+ mdl.save
817
+
818
+ # creates an SUCCESS of:
819
+ # [USER|CREATED] #1 - Max
820
+
821
+ # ------------------------------------------------------------------------------------------
822
+
823
+ # update the model
824
+ mdl.update(username: 'tester')
825
+
826
+ # creates an SUCCESS of:
827
+ # [USER|UPDATED] #1 - Max
828
+
829
+ # ------------------------------------------------------------------------------------------
830
+
831
+ # update the model again (without any change)
832
+ mdl.update(username: 'tester')
833
+
834
+ # creates an INFO of:
835
+ # [USER|SKIPPED] #1 - Max
836
+ ```
837
+
838
+ ### line(data, opts)
839
+ Prints just a line with data and line-break _(for payloads)_
840
+
841
+ ```ruby
842
+ require 'simple_logger'
843
+ l = SimpleLogger.new(:stdout)
844
+
845
+ l.line "some example line of DATA"
846
+ l.print "other example"
847
+ # > some example line of DATA
848
+ # > other example
849
+ # >
850
+ ```
851
+
852
+ ### print(data, opts)
853
+ Prints just data without line-break
854
+
855
+ ```ruby
856
+ require 'simple_logger'
857
+ l = SimpleLogger.new(:stdout)
858
+
859
+ l.print "some example line of DATA"
860
+ l.print "other example"
861
+ # > some example line of DATAother example
862
+ ```
863
+
864
+
865
+ ### nl(opts)
866
+ Prints just a line-break.
867
+
868
+ ```ruby
869
+ require 'simple_logger'
870
+ l = SimpleLogger.new(:stdout)
871
+
872
+ l.nl
873
+ # >
874
+ # >
875
+ ```
798
876
 
799
877
  -----
800
878
 
data/docs/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # RubySmart::SimpleLogger - CHANGELOG
2
2
 
3
+ ## [1.6.0] - 2025-06-13
4
+ * **[add]** `Proc` to builtins
5
+ * **[add]** better specs
6
+ * **[ref]** initialization process _(simplify, move instance-assignments to `#initialize`, rename \_opts_x to assign_x)_
7
+ * **[fix]** `Debase.logger` rewriting for Ruby 3.x _(Debase.logger is a proc instead of a Logger / STDOUT)_
8
+
3
9
  ## [1.5.3] - 2024-09-16
4
10
  * **[fix]** scene `job`-, `sub_job`-methods not working with provided block
5
11
  * **[fix]** scene `result`-methods not printing boolean results (also fixes exception for boolean/numeric results)
@@ -13,7 +13,7 @@ module RubySmart
13
13
 
14
14
  # set / overwrite default opts
15
15
  # @param [Hash] opts
16
- def _opts_init!(opts)
16
+ def assign_defaults!(opts)
17
17
  # -- level ---------------------------------------------------------------------------------------------------
18
18
 
19
19
  # initialize a default rails-dependent output
@@ -37,32 +37,17 @@ module RubySmart
37
37
  self.mask(length: ::ThreadInfo.winsize[1])
38
38
  end
39
39
 
40
- # -- instance related ----------------------------------------------------------------------------------------
41
-
42
- # ignore payload and send data directly to the logdev
43
- @ignore_payload = true if @ignore_payload.nil? && opts[:payload] == false
44
-
45
- # ignore processed logging and send data without 'leveling' & PCD-char to the logdev
46
- @ignore_processed = true if @ignore_processed.nil? && opts[:processed] == false
47
-
48
- # ignore tagged logging and send data without 'tags' to the logdev
49
- @ignore_tagged = true if @ignore_tagged.nil? && opts[:tagged] == false
50
-
51
- # set custom inspector (used for data inspection)
52
- # 'disable' inspector, if false was provided - which simply results in +#to_s+
53
- @inspector = (opts[:inspect] == false) ? :to_s : opts[:inspector]
54
-
55
- # prevent to return any data
40
+ # prevent returning any data
56
41
  nil
57
42
  end
58
43
 
59
- # enhance provided opts with +:device+.
44
+ # enhance provided opts with +:logdev+.
60
45
  # opts may be manipulated by resolved device
61
46
  # does not return any data.
62
47
  # @param [Hash] opts
63
- def _opts_device!(opts)
64
- # check for already existing +device+
65
- return if opts[:device]
48
+ def assign_logdev!(opts)
49
+ # check for already existing +logdev+
50
+ return if opts[:logdev]
66
51
 
67
52
  # remove builtin key from opts and force an array
68
53
  builtins = Array(opts.delete(:builtin))
@@ -77,20 +62,23 @@ module RubySmart
77
62
 
78
63
  # don't create multi-device for a single (or +nil+) builtin
79
64
  if builtins.length < 2
80
- opts[:device] = _resolve_device(builtins[0], opts)
65
+ opts[:logdev] = _resolve_device(builtins[0], opts)
81
66
  else
82
- opts[:device] = ::RubySmart::SimpleLogger::Devices::MultiDevice.new
67
+ opts[:logdev] = ::RubySmart::SimpleLogger::Devices::MultiDevice.new
83
68
  builtins.each do |builtin|
84
69
  # IMPORTANT: dup, original hash to prevent reference manipulation (on the TOP-level, only)
85
70
  builtin_opts = opts.dup
86
- opts[:device].register(_resolve_device(builtin, builtin_opts), _resolve_formatter(builtin_opts))
71
+ opts[:logdev].register(_resolve_device(builtin, builtin_opts), _resolve_formatter(builtin_opts))
72
+
73
+ # disable payload, if any is disabled
74
+ opts[:payload] = false if builtin_opts[:payload] == false
87
75
  end
88
76
 
89
77
  # force 'passthrough', as format, since this is required for multi-devices
90
78
  opts[:format] = :passthrough
91
79
  end
92
80
 
93
- # prevent to return any data
81
+ # prevent returning any data
94
82
  nil
95
83
  end
96
84
 
@@ -98,13 +86,13 @@ module RubySmart
98
86
  # opts may be manipulated by resolved formatter
99
87
  # does not return any data.
100
88
  # @param [Hash] opts
101
- def _opts_formatter!(opts)
89
+ def assign_formatter!(opts)
102
90
  # check for already existing +formatter+
103
91
  return if opts[:formatter]
104
92
 
105
93
  opts[:formatter] = _resolve_formatter(opts)
106
94
 
107
- # prevent to return any data
95
+ # prevent returning any data
108
96
  nil
109
97
  end
110
98
 
@@ -116,7 +104,7 @@ module RubySmart
116
104
  opts[:format] ||= :plain
117
105
 
118
106
  # fix nl - which depends on other opts
119
- opts[:nl] = _nl(opts)
107
+ opts[:nl] = _nl(opts)
120
108
 
121
109
  # fix clr
122
110
  opts[:clr] = true if opts[:clr].nil?
@@ -125,12 +113,17 @@ module RubySmart
125
113
  end
126
114
 
127
115
  # resolves & returns device from builtin & provided opts
128
- # @param [Object] builtin
116
+ # @param [Object,nil] builtin
129
117
  # @param [Hash] opts
130
118
  def _resolve_device(builtin, opts)
119
+ # in case the provided *builtin* already responds to +write+, return it
120
+ return builtin if builtin.respond_to?(:write)
121
+
131
122
  case builtin
132
123
  when nil # builtin is nil - resolve optimal device for current environment
133
- if ::ThreadInfo.stdout?
124
+ if opts.key?(:device)
125
+ _resolve_device(opts.delete(:device), opts)
126
+ elsif ::ThreadInfo.stdout?
134
127
  _resolve_device(:stdout, opts)
135
128
  elsif ::ThreadInfo.debugger?
136
129
  _resolve_device(:debugger, opts)
@@ -144,7 +137,13 @@ module RubySmart
144
137
  when :debugger
145
138
  raise "Unable to build SimpleLogger with 'debugger' builtin for not initialized Debugger!" unless ThreadInfo.debugger?
146
139
 
147
- _resolve_device(::Debugger.logger, opts)
140
+ # since some IDEs did a Debase rewriting for Ruby 3.x, the logger is a Proc instead of a Logger instance
141
+ if ::Debugger.logger.is_a?(Proc)
142
+ opts[:format] = :plain # only the data string is forwarded to the proc
143
+ ::RubySmart::SimpleLogger::Devices::ProcDevice.new(::Debugger.logger)
144
+ else
145
+ _resolve_device(::Debugger.logger, opts)
146
+ end
148
147
  when :stdout
149
148
  STDOUT
150
149
  when :stderr
@@ -161,84 +160,103 @@ module RubySmart
161
160
  _resolve_device(::Rails.logger, opts)
162
161
  end
163
162
  when :proc
164
- # force overwrite opts
165
- @ignore_payload = true
166
- opts[:nl] = false
167
- opts[:format] = :passthrough
168
-
169
- ::RubySmart::SimpleLogger::Devices::ProcDevice.new(opts.delete(:proc))
163
+ # slurp the proc and call the '_resolve_device' again
164
+ _resolve_device(opts.delete(:proc), opts)
170
165
  when :memory
171
166
  # force overwrite opts
172
- @ignore_payload = true
173
- opts[:format] = :memory
167
+ opts[:payload] = false
168
+ opts[:format] = :memory
174
169
  # no color logging for memory devices
175
170
  opts[:clr] = false
176
171
 
177
172
  ::RubySmart::SimpleLogger::Devices::MemoryDevice.new
178
- when Module, String
173
+ when Proc
179
174
  # force overwrite opts
180
- opts[:clr] = false
181
- _logdev(opts, builtin)
182
- when ::Logger
183
- builtin.instance_variable_get(:@logdev).dev
184
- else
185
- _logdev(opts, builtin)
186
- end
187
- end
188
-
189
- # resolve the final log-device from provided param
190
- # @param [Hash] opts
191
- # @param [Object] device
192
- # @return [:Logger::LogDevice]
193
- def _logdev(opts, device = nil)
194
- device ||= opts.delete(:device)
175
+ opts[:payload] = false
176
+ opts[:nl] = false
177
+ opts[:format] = :passthrough
195
178
 
196
- # if existing device is already writeable, simply return it
197
- return device if device.respond_to?(:write)
179
+ ::RubySmart::SimpleLogger::Devices::ProcDevice.new(builtin)
180
+ when Module
181
+ # no color logging for logfiles
182
+ opts[:clr] = false
198
183
 
199
- file_location = nil
184
+ logfile = _underscore(builtin.to_s) + '.log'
200
185
 
201
- # resolve the file_location from provided device
202
- case device
203
- when Module
204
- devstring = device.to_s
205
- logfile = (devstring.respond_to?(:underscore) ? devstring.underscore : _underscore(device.to_s)) + '.log'
206
- # check for rails
207
- if ::ThreadInfo.rails?
208
- file_location = File.join(Rails.root, 'log', logfile)
209
- else
210
- file_location = File.join('log', logfile)
211
- end
186
+ file_location = if ::ThreadInfo.rails? # check for rails
187
+ File.join(::Rails.root, 'log', logfile)
188
+ else
189
+ File.join('log', logfile)
190
+ end
212
191
 
213
192
  # resolve path to create a folder
214
193
  file_path = File.dirname(file_location)
215
194
  FileUtils.mkdir_p(file_path) unless File.directory?(file_path)
216
195
 
217
- # the logdev
218
- file_location
196
+ # resolve new logdev with the provided options
197
+ _logdev(file_location, opts)
219
198
  when String
220
- file_location = (device[0] == '/' ? device : "log/#{device}")
199
+ # no color logging for logfiles
200
+ opts[:clr] = false
201
+
202
+ logfile = if builtin[-4..-1] == '.log'
203
+ builtin
204
+ else
205
+ builtin + '.log'
206
+ end
207
+
208
+ file_location = if builtin[0] == '/'
209
+ builtin
210
+ elsif ::ThreadInfo.rails?
211
+ File.join(Rails.root, 'log', logfile)
212
+ else
213
+ File.join('log', logfile)
214
+ end
221
215
 
222
216
  # resolve path to create a folder
223
217
  file_path = File.dirname(file_location)
224
218
  FileUtils.mkdir_p(file_path) unless File.directory?(file_path)
225
219
 
226
- file_location
220
+ # resolve new logdev with the provided options
221
+ _logdev(file_location, opts)
222
+ when ::Logger
223
+ # resolve the logdev from the provided logger
224
+ builtin.instance_variable_get(:@logdev).dev
227
225
  else
228
- raise "Unable to build SimpleLogger! The provided device '#{device}' must respond to 'write'!"
226
+ raise "Unable to build SimpleLogger! The provided device '#{builtin}' must respond to 'write'!"
229
227
  end
228
+ end
230
229
 
230
+ # Creates and configures a new instance of Logger::LogDevice based on the provided file location
231
+ # and optional settings.
232
+ #
233
+ # The configuration differs slightly based on the Ruby version being used. For Ruby versions
234
+ # prior to 2.7, the options `:binmode` is omitted as it is not supported. For Ruby 2.7 and newer,
235
+ # the `:binmode` option is included.
236
+ #
237
+ # @param [String] file_location - the file path where the log will be written.
238
+ # @param [Hash] opts
239
+ # A hash of options to configure the log device:
240
+ # - `:shift_age` (default: 0) - Specifies the number of old log files to retain.
241
+ # - `:shift_size` (default: 1048576, 1MB) - Specifies the maximum size of the log file,
242
+ # after which the file will be rotated.
243
+ # - `:shift_period_suffix` - A string specifying the date format for rotated files (optional).
244
+ # - `:binmode` (Ruby >= 2.7 only) - Enables binary mode explicitly if set to `true`.
245
+ #
246
+ # @return [Logger::LogDevice]
247
+ # Returns a newly configured instance of Logger::LogDevice.
248
+ def _logdev(file_location, opts)
231
249
  if GemInfo.match?(RUBY_VERSION, '< 2.7')
232
250
  ::Logger::LogDevice.new(file_location,
233
- shift_age: opts[:shift_age] || 0,
234
- shift_size: opts[:shift_size] || 1048576,
251
+ shift_age: opts[:shift_age] || 0,
252
+ shift_size: opts[:shift_size] || 1048576,
235
253
  shift_period_suffix: opts[:shift_period_suffix])
236
254
  else
237
255
  ::Logger::LogDevice.new(file_location,
238
- shift_age: opts[:shift_age] || 0,
239
- shift_size: opts[:shift_size] || 1048576,
256
+ shift_age: opts[:shift_age] || 0,
257
+ shift_size: opts[:shift_size] || 1048576,
240
258
  shift_period_suffix: opts[:shift_period_suffix],
241
- binmode: opts[:binmode])
259
+ binmode: opts[:binmode])
242
260
  end
243
261
  end
244
262
 
@@ -9,8 +9,8 @@ module RubySmart
9
9
 
10
10
  module VERSION
11
11
  MAJOR = 1
12
- MINOR = 5
13
- TINY = 3
12
+ MINOR = 6
13
+ TINY = 0
14
14
  PRE = nil
15
15
 
16
16
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
@@ -47,24 +47,44 @@ module RubySmart
47
47
  # @option args[Symbol,Array] <builtin> - provide a builtin, either a single symbol or array of symbols
48
48
  # @option args[Hash] <options> - provide custom options
49
49
  def initialize(*args)
50
+ # transform args to opts
50
51
  opts = args.last.is_a?(Hash) ? args.pop : {}
51
52
  opts[:builtin] = args if args.length > 0
52
53
 
53
- # enhance options with device & formatter
54
- _opts_device!(opts)
55
- _opts_formatter!(opts)
54
+ # assign logdev to opts
55
+ assign_logdev!(opts)
56
56
 
57
- # initialize & set defaults by provided opts
58
- _opts_init!(opts)
57
+ # assign formatter to opts
58
+ assign_formatter!(opts)
59
+
60
+ # assign default opts
61
+ assign_defaults!(opts)
59
62
 
60
63
  # initialize with a nil +logdev+ to prevent any nested +LogDevice+ creation.
61
64
  # we already arranged device & formatter to be able to respond to ther required methods
62
65
  super(nil)
63
66
 
64
- # set explicit after called super
67
+ # level must be set through the *_level* method, to prevent invalid values
65
68
  self.level = opts[:level]
69
+
70
+ # use the provided formatter
66
71
  self.formatter = opts[:formatter]
67
- @logdev = _logdev(opts)
72
+
73
+ # ignore payload and send data directly to the logdev
74
+ @ignore_payload = true if opts[:payload] == false
75
+
76
+ # ignore processed logging and send data without 'leveling' & PCD-char to the logdev
77
+ @ignore_processed = true if opts[:processed] == false
78
+
79
+ # ignore tagged logging and send data without 'tags' to the logdev
80
+ @ignore_tagged = true if opts[:tagged] == false
81
+
82
+ # set custom inspector (used for data inspection)
83
+ # 'disable' inspector, if false was provided - which simply results in +#to_s+
84
+ @inspector = (opts[:inspect] == false) ? :to_s : opts[:inspector]
85
+
86
+ # set resolved logdev
87
+ @logdev = opts[:logdev]
68
88
  end
69
89
 
70
90
  # overwrite level setter, to accept every available (also newly defined) Severity
@@ -85,9 +85,9 @@ module RubySmart
85
85
  # log level @ debug
86
86
  # prints: prettified subject
87
87
  #
88
- # > ===========================================================================================================
89
- # > ================================================ <Subject> ================================================
90
- # > ===========================================================================================================
88
+ # > ========================================================================================================================
89
+ # > ======================================================= <Subject> ======================================================
90
+ # > ========================================================================================================================
91
91
  base.scene :header, { level: :debug, payload: [:mask, [:mask, ' <%{subject}> '], :mask] } do |subject, **opts|
92
92
  # autostart a timer method, if required
93
93
  self.timer(:start, :default) if opts[:timer]
@@ -99,9 +99,9 @@ module RubySmart
99
99
  # log level @ debug
100
100
  # prints: prettified subject
101
101
  #
102
- # > ===========================================================================================================
103
- # > ================================================ >Subject< ================================================
104
- # > ===========================================================================================================
102
+ # > ========================================================================================================================
103
+ # > ======================================================= >Subject< ======================================================
104
+ # > ========================================================================================================================
105
105
  base.scene :footer, { level: :debug, payload: [:mask, [:mask, ' >%{subject}< '], :mask] } do |subject, **opts|
106
106
  self.log nil, _scene_opts(:footer, subject: subject.to_s, **opts)
107
107
 
@@ -113,9 +113,9 @@ module RubySmart
113
113
  # log level @ debug
114
114
  # prints: prettified subject
115
115
  #
116
- # > --------------------------------------------------------------------------------
117
- # > #----------------------------------- Subject ----------------------------------#
118
- # > --------------------------------------------------------------------------------
116
+ # > -----------------------------------------------------------------------------------------------
117
+ # > #------------------------------------------ Subject ------------------------------------------#
118
+ # > -----------------------------------------------------------------------------------------------
119
119
  base.scene :topic, { level: :debug, mask: { char: '-', length: 95, clr: :blueish }, payload: [:mask, [:mask, '%{title}'], :mask] } do |subject, **opts|
120
120
  opts = _scene_opts(:topic, **opts)
121
121
  txt = " #{subject} ".center(opts[:mask][:length] - 2, opts[:mask][:char])
@@ -129,7 +129,7 @@ module RubySmart
129
129
  # prints: prettified, colored subject
130
130
  #
131
131
  # > # Subject
132
- # > ----------------------------------------------------------------------
132
+ # > -------------------------------------------------------------------------------------
133
133
  base.scene :theme, { level: :debug, clr: :purple, mask: { char: '-', length: 85, clr: :purple }, payload: [[:txt, '# %{subject}'], :mask] } do |subject, **opts|
134
134
  self.log nil, _scene_opts(:theme, subject: subject.to_s, **opts)
135
135
  end
@@ -138,7 +138,7 @@ module RubySmart
138
138
  # log level @ debug
139
139
  # prints: prettified, colored result
140
140
  #
141
- # > ----------------------------------------------------------------------
141
+ # > -------------------------------------------------------------------------------------
142
142
  # > -> Result
143
143
  # >
144
144
  base.scene :theme_result, { level: :debug, mask: { char: '-', length: 85, clr: :purple }, payload: [:mask, [:txt, '-> %{result}'], ''] } do |result, status = nil, **opts|
@@ -149,7 +149,7 @@ module RubySmart
149
149
  # log level @ debug
150
150
  # prints: colored line with no text
151
151
  #
152
- # > ----------------------------------------------------------------------
152
+ # > -------------------------------------------------------------------------------------
153
153
  base.scene :theme_line, { level: :debug, mask: { char: '-', length: 85, clr: :purple }, payload: [:mask] } do |**opts|
154
154
  self.log nil, _scene_opts(:theme_line, **opts)
155
155
  end
@@ -170,7 +170,7 @@ module RubySmart
170
170
  # calls the result method if a block was provided
171
171
  #
172
172
  # > - Job name =>
173
- # ________________________________________________________________ <- 64 chars
173
+ # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ <- 64 chars
174
174
  base.scene :job, { level: :debug, clr: :cyan, nl: false, length: 64, payload: [[:concat, ['- ', [:txt, '%{name}'], ' => ']]] } do |name, **opts, &block|
175
175
  self.log nil, _scene_opts(:job, name: name, **opts)
176
176
  self.result(*block.call) if block
@@ -182,7 +182,7 @@ module RubySmart
182
182
  # calls the result method if a block was provided
183
183
  #
184
184
  # > * Subjob name =>
185
- # ______________________________________________________________ <- 62 chars
185
+ # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ <- 62 chars
186
186
  base.scene :sub_job, { level: :debug, clr: :cyan, nl: false, length: 62, payload: [[:concat, [' * ', [:txt, '%{name}'], ' => ']]] } do |name, **opts, &block|
187
187
  self.log nil, _scene_opts(:sub_job, name: name, **opts)
188
188
  self.result(*block.call) if block
@@ -331,6 +331,7 @@ module RubySmart
331
331
  end
332
332
  rescue => e
333
333
  self.fatal("#{e.message} @ #{e.backtrace_locations&.first}") unless opts[:silent]
334
+
334
335
  # reraise exception
335
336
  raise
336
337
  ensure
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_smart-simple_logger
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.3
4
+ version: 1.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tobias Gonsior
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-09-16 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: ruby_smart-support
@@ -175,7 +174,6 @@ metadata:
175
174
  documentation_uri: https://rubydoc.info/gems/ruby_smart-simple_logger
176
175
  changelog_uri: https://github.com/ruby-smart/simple_logger/blob/main/docs/CHANGELOG.md
177
176
  allowed_push_host: https://rubygems.org
178
- post_install_message:
179
177
  rdoc_options: []
180
178
  require_paths:
181
179
  - lib
@@ -190,8 +188,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
190
188
  - !ruby/object:Gem::Version
191
189
  version: '0'
192
190
  requirements: []
193
- rubygems_version: 3.5.14
194
- signing_key:
191
+ rubygems_version: 3.6.9
195
192
  specification_version: 4
196
193
  summary: A simple, multifunctional logging library for Ruby (and Rails).
197
194
  test_files: []