logrb 0.1.4 → 0.2.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 +4 -4
- data/.rubocop.yml +1 -1
- data/Gemfile +6 -2
- data/Gemfile.lock +110 -36
- data/lib/logrb/noop_logger.rb +16 -0
- data/lib/logrb/version.rb +1 -1
- data/lib/logrb.rb +11 -2
- data/logrb.gemspec +2 -1
- metadata +6 -7
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6c17c7410613ded8c7e116fca41aae034fa91141f0a48692d91a7cab2c998abf
|
|
4
|
+
data.tar.gz: ac539a5f25c4b3be7e348b6eb96634d1d46b2bf5adedb79092a04782c324e1e0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: '0281174b18cf81d1f6fdaf9a8583a7d02772166e3e75a149071771124d5e7112f5d7497a2af2ef4ea287b5f42e5094fcccac32a075214291f9e2a9ad29033c42'
|
|
7
|
+
data.tar.gz: 83f932437612a7ab4d735e1d7d41f8c004e5910be0c613632151eceac255658a009600bbc29a42a7b8115808408368288342f7b01acb9249816e92c724e2bb8b
|
data/.rubocop.yml
CHANGED
data/Gemfile
CHANGED
|
@@ -2,11 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
source "https://rubygems.org"
|
|
4
4
|
|
|
5
|
-
# Specify your gem's dependencies in
|
|
5
|
+
# Specify your gem's dependencies in mfp.gemspec
|
|
6
6
|
gemspec
|
|
7
7
|
|
|
8
|
+
gem "irb"
|
|
9
|
+
|
|
8
10
|
gem "rake", "~> 13.0"
|
|
9
11
|
|
|
10
12
|
gem "rspec", "~> 3.0"
|
|
11
13
|
|
|
12
|
-
gem "rubocop", "~> 1.
|
|
14
|
+
gem "rubocop", "~> 1.21", require: false
|
|
15
|
+
|
|
16
|
+
gem "debug", "~> 1.11"
|
data/Gemfile.lock
CHANGED
|
@@ -1,59 +1,133 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
logrb (0.
|
|
4
|
+
logrb (0.2.0)
|
|
5
5
|
hexdump (~> 0.3.0)
|
|
6
6
|
|
|
7
7
|
GEM
|
|
8
8
|
remote: https://rubygems.org/
|
|
9
9
|
specs:
|
|
10
|
-
ast (2.4.
|
|
11
|
-
|
|
10
|
+
ast (2.4.3)
|
|
11
|
+
debug (1.11.1)
|
|
12
|
+
irb (~> 1.10)
|
|
13
|
+
reline (>= 0.3.8)
|
|
14
|
+
diff-lcs (1.6.2)
|
|
15
|
+
erb (6.0.7)
|
|
12
16
|
hexdump (0.3.0)
|
|
13
|
-
|
|
14
|
-
|
|
17
|
+
io-console (0.9.0)
|
|
18
|
+
irb (1.18.0)
|
|
19
|
+
pp (>= 0.6.0)
|
|
20
|
+
prism (>= 1.3.0)
|
|
21
|
+
rdoc (>= 4.0.0)
|
|
22
|
+
reline (>= 0.4.2)
|
|
23
|
+
json (2.21.2)
|
|
24
|
+
language_server-protocol (3.17.0.6)
|
|
25
|
+
lint_roller (1.1.0)
|
|
26
|
+
logger (1.7.0)
|
|
27
|
+
parallel (2.1.0)
|
|
28
|
+
parser (3.3.12.0)
|
|
15
29
|
ast (~> 2.4.1)
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
30
|
+
racc
|
|
31
|
+
pp (0.6.4)
|
|
32
|
+
prettyprint
|
|
33
|
+
prettyprint (0.2.0)
|
|
34
|
+
prism (1.9.0)
|
|
35
|
+
racc (1.8.1)
|
|
36
|
+
rainbow (3.1.1)
|
|
37
|
+
rake (13.4.2)
|
|
38
|
+
rbs (4.1.2)
|
|
39
|
+
logger
|
|
40
|
+
prism (>= 1.6.0)
|
|
41
|
+
tsort
|
|
42
|
+
rdoc (8.0.0)
|
|
43
|
+
erb
|
|
44
|
+
prism (>= 1.6.0)
|
|
45
|
+
rbs (>= 4.0.0)
|
|
46
|
+
tsort
|
|
47
|
+
regexp_parser (2.12.0)
|
|
48
|
+
reline (0.7.0)
|
|
49
|
+
io-console (~> 0.5)
|
|
50
|
+
rspec (3.13.2)
|
|
51
|
+
rspec-core (~> 3.13.0)
|
|
52
|
+
rspec-expectations (~> 3.13.0)
|
|
53
|
+
rspec-mocks (~> 3.13.0)
|
|
54
|
+
rspec-core (3.13.6)
|
|
55
|
+
rspec-support (~> 3.13.0)
|
|
56
|
+
rspec-expectations (3.13.5)
|
|
27
57
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
28
|
-
rspec-support (~> 3.
|
|
29
|
-
rspec-mocks (3.
|
|
58
|
+
rspec-support (~> 3.13.0)
|
|
59
|
+
rspec-mocks (3.13.8)
|
|
30
60
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
31
|
-
rspec-support (~> 3.
|
|
32
|
-
rspec-support (3.
|
|
33
|
-
rubocop (1.
|
|
34
|
-
|
|
35
|
-
|
|
61
|
+
rspec-support (~> 3.13.0)
|
|
62
|
+
rspec-support (3.13.7)
|
|
63
|
+
rubocop (1.89.0)
|
|
64
|
+
json (~> 2.3)
|
|
65
|
+
language_server-protocol (~> 3.17.0.2)
|
|
66
|
+
lint_roller (~> 1.1.0)
|
|
67
|
+
parallel (>= 1.10)
|
|
68
|
+
parser (>= 3.3.0.2)
|
|
36
69
|
rainbow (>= 2.2.2, < 4.0)
|
|
37
|
-
regexp_parser (>=
|
|
38
|
-
|
|
39
|
-
rubocop-ast (>= 1.9.1, < 2.0)
|
|
70
|
+
regexp_parser (>= 2.9.3, < 3.0)
|
|
71
|
+
rubocop-ast (>= 1.49.0, < 2.0)
|
|
40
72
|
ruby-progressbar (~> 1.7)
|
|
41
|
-
unicode-display_width (>=
|
|
42
|
-
rubocop-ast (1.
|
|
43
|
-
parser (>= 3.
|
|
44
|
-
|
|
45
|
-
|
|
73
|
+
unicode-display_width (>= 2.4.0, < 4.0)
|
|
74
|
+
rubocop-ast (1.50.0)
|
|
75
|
+
parser (>= 3.3.7.2)
|
|
76
|
+
prism (~> 1.7)
|
|
77
|
+
ruby-progressbar (1.13.0)
|
|
78
|
+
tsort (0.2.0)
|
|
79
|
+
unicode-display_width (3.2.0)
|
|
80
|
+
unicode-emoji (~> 4.1)
|
|
81
|
+
unicode-emoji (4.2.0)
|
|
46
82
|
|
|
47
83
|
PLATFORMS
|
|
48
|
-
arm64-darwin-
|
|
49
|
-
|
|
50
|
-
x86_64-linux
|
|
84
|
+
arm64-darwin-25
|
|
85
|
+
ruby
|
|
51
86
|
|
|
52
87
|
DEPENDENCIES
|
|
88
|
+
debug (~> 1.11)
|
|
89
|
+
irb
|
|
53
90
|
logrb!
|
|
54
91
|
rake (~> 13.0)
|
|
55
92
|
rspec (~> 3.0)
|
|
56
|
-
rubocop (~> 1.
|
|
93
|
+
rubocop (~> 1.21)
|
|
94
|
+
|
|
95
|
+
CHECKSUMS
|
|
96
|
+
ast (2.4.3) sha256=954615157c1d6a382bc27d690d973195e79db7f55e9765ac7c481c60bdb4d383
|
|
97
|
+
debug (1.11.1) sha256=2e0b0ac6119f2207a6f8ac7d4a73ca8eb4e440f64da0a3136c30343146e952b6
|
|
98
|
+
diff-lcs (1.6.2) sha256=9ae0d2cba7d4df3075fe8cd8602a8604993efc0dfa934cff568969efb1909962
|
|
99
|
+
erb (6.0.7) sha256=c5ca6dc25b0ef974a44dc8f59fe847577122483b1968a38dec305c60bf91ee92
|
|
100
|
+
hexdump (0.3.0) sha256=0a2bd81b07e807b0f9e39b93b1fe431b209877e77a98463312ceffaef0c33fc8
|
|
101
|
+
io-console (0.9.0) sha256=b8946037a2e385580665c31aa593c785923fe900c694d86da011fd48e51e3868
|
|
102
|
+
irb (1.18.0) sha256=de9454a0703a54704b9811a5ef31a60c86949fbf4013fcf244fabc7c775248e3
|
|
103
|
+
json (2.21.2) sha256=1f1d3b7cf2b3ba1a69beca0bb6db13d5438b80bff3cd54cdaaa620b9b07c1c6a
|
|
104
|
+
language_server-protocol (3.17.0.6) sha256=5ef2c0c138f8267e1bc631d3328347d354f96724b0af22f2c79516120443b7f0
|
|
105
|
+
lint_roller (1.1.0) sha256=2c0c845b632a7d172cb849cc90c1bce937a28c5c8ccccb50dfd46a485003cc87
|
|
106
|
+
logger (1.7.0) sha256=196edec7cc44b66cfb40f9755ce11b392f21f7967696af15d274dde7edff0203
|
|
107
|
+
logrb (0.2.0)
|
|
108
|
+
parallel (2.1.0) sha256=b35258865c2e31134c5ecb708beaaf6772adf9d5efae28e93e99260877b09356
|
|
109
|
+
parser (3.3.12.0) sha256=21a6d7f755d5a24dfbdc6e6b772e4e879a52e7631a88bc5a3a134606052c9828
|
|
110
|
+
pp (0.6.4) sha256=dfcb0fce700c41456265922884f9fe195d7fbb0674a3578e6c0f69588e82b570
|
|
111
|
+
prettyprint (0.2.0) sha256=2bc9e15581a94742064a3cc8b0fb9d45aae3d03a1baa6ef80922627a0766f193
|
|
112
|
+
prism (1.9.0) sha256=7b530c6a9f92c24300014919c9dcbc055bf4cdf51ec30aed099b06cd6674ef85
|
|
113
|
+
racc (1.8.1) sha256=4a7f6929691dbec8b5209a0b373bc2614882b55fc5d2e447a21aaa691303d62f
|
|
114
|
+
rainbow (3.1.1) sha256=039491aa3a89f42efa1d6dec2fc4e62ede96eb6acd95e52f1ad581182b79bc6a
|
|
115
|
+
rake (13.4.2) sha256=cb825b2bd5f1f8e91ca37bddb4b9aaf345551b4731da62949be002fa89283701
|
|
116
|
+
rbs (4.1.2) sha256=050eb1d8b508f1233bed929c0f2c7052302f7adf295230d9cb314e9024078f48
|
|
117
|
+
rdoc (8.0.0) sha256=03bf8c08a9639658855a0cfd77c0abca8325c227693f7f33f82957811348c469
|
|
118
|
+
regexp_parser (2.12.0) sha256=35a916a1d63190ab5c9009457136ae5f3c0c7512d60291d0d1378ba18ce08ebb
|
|
119
|
+
reline (0.7.0) sha256=5b012d8e55dbf9d450f12bde2cf7d15ff546ae80b3f8f3b30e570d431815583d
|
|
120
|
+
rspec (3.13.2) sha256=206284a08ad798e61f86d7ca3e376718d52c0bc944626b2349266f239f820587
|
|
121
|
+
rspec-core (3.13.6) sha256=a8823c6411667b60a8bca135364351dda34cd55e44ff94c4be4633b37d828b2d
|
|
122
|
+
rspec-expectations (3.13.5) sha256=33a4d3a1d95060aea4c94e9f237030a8f9eae5615e9bd85718fe3a09e4b58836
|
|
123
|
+
rspec-mocks (3.13.8) sha256=086ad3d3d17533f4237643de0b5c42f04b66348c28bf6b9c2d3f4a3b01af1d47
|
|
124
|
+
rspec-support (3.13.7) sha256=0640e5570872aafefd79867901deeeeb40b0c9875a36b983d85f54fb7381c47c
|
|
125
|
+
rubocop (1.89.0) sha256=4dee8e3ee9c45e474834efd9e8d6fd031e8331c8dacdff0de4ad65ae0a6faae7
|
|
126
|
+
rubocop-ast (1.50.0) sha256=b9ca88300da0803ee222ad20cdb30494c0a784eed06fdc35d254b06d662788db
|
|
127
|
+
ruby-progressbar (1.13.0) sha256=80fc9c47a9b640d6834e0dc7b3c94c9df37f08cb072b7761e4a71e22cff29b33
|
|
128
|
+
tsort (0.2.0) sha256=9650a793f6859a43b6641671278f79cfead60ac714148aabe4e3f0060480089f
|
|
129
|
+
unicode-display_width (3.2.0) sha256=0cdd96b5681a5949cdbc2c55e7b420facae74c4aaf9a9815eee1087cb1853c42
|
|
130
|
+
unicode-emoji (4.2.0) sha256=519e69150f75652e40bf736106cfbc8f0f73aa3fb6a65afe62fefa7f80b0f80f
|
|
57
131
|
|
|
58
132
|
BUNDLED WITH
|
|
59
|
-
|
|
133
|
+
4.0.16
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
class Logrb
|
|
4
|
+
class NoopLogger
|
|
5
|
+
def initialize(*); end
|
|
6
|
+
def with_fields(**) = self
|
|
7
|
+
def error(*, **) = self
|
|
8
|
+
def fatal(*, **) = self
|
|
9
|
+
def unknown(*, **) = self
|
|
10
|
+
def warn(*, **) = self
|
|
11
|
+
def info(*, **) = self
|
|
12
|
+
def debug(*, **) = self
|
|
13
|
+
def reset(*, **) = self
|
|
14
|
+
def dump(*, **) = self
|
|
15
|
+
end
|
|
16
|
+
end
|
data/lib/logrb/version.rb
CHANGED
data/lib/logrb.rb
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require_relative "logrb/version"
|
|
4
|
+
require_relative "logrb/noop_logger"
|
|
4
5
|
require "hexdump"
|
|
5
6
|
require "json"
|
|
6
7
|
|
|
@@ -33,6 +34,12 @@ require "json"
|
|
|
33
34
|
# #dump(msg, data=nil): Outputs a given String or Array of bytes using the
|
|
34
35
|
# same format as `hexdump -C`.
|
|
35
36
|
class Logrb
|
|
37
|
+
NOOP = NoopLogger.new
|
|
38
|
+
|
|
39
|
+
# Returns a logger that does not perform any kind of operation; all calls
|
|
40
|
+
# to its methods are noops, while exposing the same interface of Logrb itself.
|
|
41
|
+
def self.noop = Logrb::NOOP
|
|
42
|
+
|
|
36
43
|
attr_accessor :fields, :level, :format
|
|
37
44
|
|
|
38
45
|
COLORS = {
|
|
@@ -71,7 +78,7 @@ class Logrb
|
|
|
71
78
|
# output - an IO-like object that implements a #write method.
|
|
72
79
|
# format - Optional. Indicates the format used to output log entries.
|
|
73
80
|
# Supports :text (default) and :json.
|
|
74
|
-
# level - Level to filter this logger instance
|
|
81
|
+
# level - Level to filter this logger instance. Defaults to :debug
|
|
75
82
|
# fields - Fields to include in emitted entries
|
|
76
83
|
def initialize(output, format: :text, level: :debug, **fields)
|
|
77
84
|
@output = output
|
|
@@ -182,7 +189,7 @@ class Logrb
|
|
|
182
189
|
if (root = Gem.path.find { |p| path.start_with?(p) })
|
|
183
190
|
path = "$GEM_PATH#{path[root.length..]}"
|
|
184
191
|
end
|
|
185
|
-
"#{path}:#{trace.lineno}#{
|
|
192
|
+
"#{path}:#{trace.lineno}#{" in `#{trace.label}'" if include_function_name}"
|
|
186
193
|
end
|
|
187
194
|
|
|
188
195
|
# Internal: Returns a string containing a stacktrace of the current
|
|
@@ -223,6 +230,7 @@ class Logrb
|
|
|
223
230
|
fields.merge! @fields
|
|
224
231
|
write_output(compose_line(level, caller_meta, msg, fields))
|
|
225
232
|
if (error_message = error&.message)
|
|
233
|
+
write_output(": #{error.class.name}")
|
|
226
234
|
write_output(": #{error_message}")
|
|
227
235
|
end
|
|
228
236
|
write_output("\n")
|
|
@@ -274,6 +282,7 @@ class Logrb
|
|
|
274
282
|
}
|
|
275
283
|
|
|
276
284
|
if level == :error
|
|
285
|
+
data[:exception_class] = error.class.to_s
|
|
277
286
|
data[:exception] = error.message if error.respond_to?(:message)
|
|
278
287
|
data[:stacktrace] = backtrace(error)
|
|
279
288
|
end
|
data/logrb.gemspec
CHANGED
|
@@ -12,11 +12,12 @@ Gem::Specification.new do |spec|
|
|
|
12
12
|
spec.description = "Small logger inspired by Go's Zap"
|
|
13
13
|
spec.homepage = "https://github.com/heyvito/logrb"
|
|
14
14
|
spec.license = "MIT"
|
|
15
|
-
spec.required_ruby_version = ">=
|
|
15
|
+
spec.required_ruby_version = ">= 3.0"
|
|
16
16
|
|
|
17
17
|
spec.metadata["homepage_uri"] = spec.homepage
|
|
18
18
|
spec.metadata["source_code_uri"] = spec.homepage
|
|
19
19
|
spec.metadata["changelog_uri"] = spec.homepage
|
|
20
|
+
spec.metadata["rubygems_mfa_required"] = "true"
|
|
20
21
|
|
|
21
22
|
# Specify which files should be added to the gem when it is released.
|
|
22
23
|
# The `git ls-files -z` loads the files in the RubyGem that have been added
|
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: logrb
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Vito Sartori
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: exe
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: hexdump
|
|
@@ -44,6 +43,7 @@ files:
|
|
|
44
43
|
- bin/console
|
|
45
44
|
- bin/setup
|
|
46
45
|
- lib/logrb.rb
|
|
46
|
+
- lib/logrb/noop_logger.rb
|
|
47
47
|
- lib/logrb/version.rb
|
|
48
48
|
- logrb.gemspec
|
|
49
49
|
homepage: https://github.com/heyvito/logrb
|
|
@@ -53,7 +53,7 @@ metadata:
|
|
|
53
53
|
homepage_uri: https://github.com/heyvito/logrb
|
|
54
54
|
source_code_uri: https://github.com/heyvito/logrb
|
|
55
55
|
changelog_uri: https://github.com/heyvito/logrb
|
|
56
|
-
|
|
56
|
+
rubygems_mfa_required: 'true'
|
|
57
57
|
rdoc_options: []
|
|
58
58
|
require_paths:
|
|
59
59
|
- lib
|
|
@@ -61,15 +61,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
61
61
|
requirements:
|
|
62
62
|
- - ">="
|
|
63
63
|
- !ruby/object:Gem::Version
|
|
64
|
-
version:
|
|
64
|
+
version: '3.0'
|
|
65
65
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
66
66
|
requirements:
|
|
67
67
|
- - ">="
|
|
68
68
|
- !ruby/object:Gem::Version
|
|
69
69
|
version: '0'
|
|
70
70
|
requirements: []
|
|
71
|
-
rubygems_version:
|
|
72
|
-
signing_key:
|
|
71
|
+
rubygems_version: 4.0.16
|
|
73
72
|
specification_version: 4
|
|
74
73
|
summary: Small logger inspired by Go's Zap
|
|
75
74
|
test_files: []
|