ruby_smart-simple_logger 1.6.0 → 1.6.1
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: 4600b91c524058555c2e5cf031f0b1496816b46427b9e9e3d0db67e501c2394d
|
|
4
|
+
data.tar.gz: 6e837fc7b6d9a594c36036165cb5e5e96384cdef0c887aa6c552d91eb45baa3a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7974dd43f3471c4973da06e442db5b8685efa1a561a11437c55f361d270af17609ea679ab1819e41025a6d15fdb6c62d097d8c1296a9671c96710f3bbcd55ae8
|
|
7
|
+
data.tar.gz: dc344203c08448d5008d804cfd65e7b9292e6c625c1462c122564ba5978f0f022e893405e10447a2dc81508a0f2770134dafdd3fe2ca8d974d62869dc6d50da1
|
data/docs/CHANGELOG.md
CHANGED
|
@@ -103,8 +103,8 @@ module RubySmart
|
|
|
103
103
|
# set default format
|
|
104
104
|
opts[:format] ||= :plain
|
|
105
105
|
|
|
106
|
-
# fix nl
|
|
107
|
-
opts[:nl] =
|
|
106
|
+
# fix nl
|
|
107
|
+
opts[:nl] = true if opts[:nl].nil?
|
|
108
108
|
|
|
109
109
|
# fix clr
|
|
110
110
|
opts[:clr] = true if opts[:clr].nil?
|
|
@@ -139,7 +139,10 @@ module RubySmart
|
|
|
139
139
|
|
|
140
140
|
# since some IDEs did a Debase rewriting for Ruby 3.x, the logger is a Proc instead of a Logger instance
|
|
141
141
|
if ::Debugger.logger.is_a?(Proc)
|
|
142
|
-
|
|
142
|
+
# only the data string is forwarded to the proc
|
|
143
|
+
opts[:format] = :plain
|
|
144
|
+
# the newline is handled by the logger itself
|
|
145
|
+
opts[:nl] = false
|
|
143
146
|
::RubySmart::SimpleLogger::Devices::ProcDevice.new(::Debugger.logger)
|
|
144
147
|
else
|
|
145
148
|
_resolve_device(::Debugger.logger, opts)
|
|
@@ -168,6 +171,8 @@ module RubySmart
|
|
|
168
171
|
opts[:format] = :memory
|
|
169
172
|
# no color logging for memory devices
|
|
170
173
|
opts[:clr] = false
|
|
174
|
+
# no newline (just for completeness - however the "memory" formatter does NEVER include *nl*)
|
|
175
|
+
opts[:nl] = false
|
|
171
176
|
|
|
172
177
|
::RubySmart::SimpleLogger::Devices::MemoryDevice.new
|
|
173
178
|
when Proc
|
|
@@ -273,16 +278,6 @@ module RubySmart
|
|
|
273
278
|
word
|
|
274
279
|
end
|
|
275
280
|
|
|
276
|
-
# returns the +nl+ (new line) flag, depending on the provided options.
|
|
277
|
-
# recognizes +:nl+ and +:payload+ options.
|
|
278
|
-
# @param [Hash] opts
|
|
279
|
-
# @return [Boolean]
|
|
280
|
-
def _nl(opts)
|
|
281
|
-
return opts[:nl] unless opts[:nl].nil?
|
|
282
|
-
|
|
283
|
-
opts[:payload].is_a?(FalseClass)
|
|
284
|
-
end
|
|
285
|
-
|
|
286
281
|
# merge all provided hashes into one single hash
|
|
287
282
|
#
|
|
288
283
|
# @example
|
|
@@ -171,18 +171,23 @@ module RubySmart
|
|
|
171
171
|
end
|
|
172
172
|
end
|
|
173
173
|
|
|
174
|
-
# returns the formatted string with a new-line.
|
|
174
|
+
# returns the formatted string with or without a new-line.
|
|
175
|
+
# Also drops a trailing new-line, if it exists.
|
|
175
176
|
# depends, on the +:nl+ option.
|
|
176
177
|
# @param [String, Array] data
|
|
177
178
|
# @return [String]
|
|
178
179
|
def _nl(data)
|
|
179
|
-
# convert to string
|
|
180
|
+
# convert possible array to string
|
|
180
181
|
data = data.join("\n") if data.is_a?(Array)
|
|
181
182
|
|
|
182
|
-
# check
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
data
|
|
183
|
+
# check, if a nl-flag should be added or dropped
|
|
184
|
+
if opts[:nl] && data[-1] != "\n"
|
|
185
|
+
data + "\n"
|
|
186
|
+
elsif !opts[:nl] && data[-1] == "\n"
|
|
187
|
+
data[0..-2]
|
|
188
|
+
else
|
|
189
|
+
data
|
|
190
|
+
end
|
|
186
191
|
end
|
|
187
192
|
|
|
188
193
|
# returns the formatted string with a color-code
|
data/lib/ruby_smart-debugger.rb
CHANGED
|
@@ -13,11 +13,11 @@ module Debugger
|
|
|
13
13
|
extend ::RubySmart::SimpleLogger::KlassLogger
|
|
14
14
|
|
|
15
15
|
# force debugger to 'DEBUG' severity
|
|
16
|
-
self.klass_logger_opts = {level: ::RubySmart::SimpleLogger::Logger::DEBUG}
|
|
16
|
+
self.klass_logger_opts = { level: ::RubySmart::SimpleLogger::Logger::DEBUG }
|
|
17
17
|
|
|
18
|
-
# overwrite existing "debug" method (if Debase was loaded)
|
|
19
|
-
def self.debug(*args)
|
|
18
|
+
# overwrite existing "debug" method (if Debase was loaded, this needs to be rewritten)
|
|
19
|
+
def self.debug(*args, **kwargs)
|
|
20
20
|
return false if args.none?
|
|
21
|
-
klass_logger.debug(*args)
|
|
21
|
+
klass_logger.debug(*args, **kwargs)
|
|
22
22
|
end
|
|
23
23
|
end
|