console 1.23.1 → 1.23.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/console/capture.rb +5 -1
- data/lib/console/compatible/logger.rb +1 -1
- data/lib/console/format/safe.rb +33 -13
- data/lib/console/output/json.rb +1 -1
- data/lib/console/terminal/logger.rb +8 -2
- data/lib/console/version.rb +1 -1
- data/readme.md +13 -1
- data.tar.gz.sig +0 -0
- metadata +4 -4
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dd6108c241ee21f1f785bd0686d958e586d647c0320b0edfcbae7fdaff275155
|
4
|
+
data.tar.gz: eac618496cbeedb26503082d99a1e34904229b00bd213e38acaf2d5044af7a2c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3b0335cc888c818b29cc1f12fbb62228107b7838e526481110383abb896c7f46bd006e324781a08a872bf90f047bcbf3507a6c638f4bda2b32008b1e10765315
|
7
|
+
data.tar.gz: 3e7db728a24bc033c6e2c8338996efc19d8cfdecc8f3d9f22857112500c99f00633483f2ec5ebd6a935aaece3f02ca1d7033a3e7c9c3987de60b81517bae5777
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/console/capture.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# Released under the MIT License.
|
4
|
-
# Copyright, 2019-
|
4
|
+
# Copyright, 2019-2023, by Samuel Williams.
|
5
5
|
|
6
6
|
require_relative 'filter'
|
7
7
|
|
@@ -55,6 +55,10 @@ module Console
|
|
55
55
|
message[:arguments] = arguments
|
56
56
|
end
|
57
57
|
|
58
|
+
if annotation = Fiber.current.annotation
|
59
|
+
message[:annotation] = annotation
|
60
|
+
end
|
61
|
+
|
58
62
|
if block_given?
|
59
63
|
if block.arity.zero?
|
60
64
|
message[:message] = yield
|
data/lib/console/format/safe.rb
CHANGED
@@ -24,22 +24,38 @@ module Console
|
|
24
24
|
|
25
25
|
private
|
26
26
|
|
27
|
-
def default_objects
|
28
|
-
Hash.new.compare_by_identity
|
29
|
-
end
|
30
|
-
|
31
|
-
# The first N frames, noting that the last frame is a placeholder for all the skipped frames:
|
32
|
-
FIRST_N_FRAMES = 10 + 1
|
33
|
-
LAST_N_FRAMES = 20
|
34
|
-
MAXIMUM_FRAMES = FIRST_N_FRAMES + LAST_N_FRAMES
|
35
|
-
|
36
27
|
def filter_backtrace(error)
|
37
28
|
frames = error.backtrace
|
29
|
+
filtered = {}
|
30
|
+
filtered_count = nil
|
31
|
+
skipped = nil
|
32
|
+
|
33
|
+
frames = frames.filter_map do |frame|
|
34
|
+
if filtered[frame]
|
35
|
+
if filtered_count == nil
|
36
|
+
filtered_count = 1
|
37
|
+
skipped = frame.dup
|
38
|
+
else
|
39
|
+
filtered_count += 1
|
40
|
+
nil
|
41
|
+
end
|
42
|
+
else
|
43
|
+
if skipped
|
44
|
+
if filtered_count > 1
|
45
|
+
skipped.replace("[... #{filtered_count} frames skipped ...]")
|
46
|
+
end
|
47
|
+
|
48
|
+
filtered_count = nil
|
49
|
+
skipped = nil
|
50
|
+
end
|
51
|
+
|
52
|
+
filtered[frame] = true
|
53
|
+
frame
|
54
|
+
end
|
55
|
+
end
|
38
56
|
|
39
|
-
|
40
|
-
|
41
|
-
frames[FIRST_N_FRAMES-1] = "[... #{frames.size - (MAXIMUM_FRAMES-1)} frames ...]"
|
42
|
-
frames.slice!(FIRST_N_FRAMES...-LAST_N_FRAMES)
|
57
|
+
if skipped && filtered_count > 1
|
58
|
+
skipped.replace("[... #{filtered_count} frames skipped ...]")
|
43
59
|
end
|
44
60
|
|
45
61
|
return frames
|
@@ -69,6 +85,10 @@ module Console
|
|
69
85
|
end
|
70
86
|
end
|
71
87
|
|
88
|
+
def default_objects
|
89
|
+
Hash.new.compare_by_identity
|
90
|
+
end
|
91
|
+
|
72
92
|
# This will recursively generate a safe version of the object.
|
73
93
|
# Nested hashes and arrays will be transformed recursively.
|
74
94
|
# Strings will be encoded with the given encoding.
|
data/lib/console/output/json.rb
CHANGED
@@ -149,8 +149,14 @@ module Console
|
|
149
149
|
buffer = +""
|
150
150
|
|
151
151
|
if @verbose
|
152
|
-
if annotation = Fiber.current.annotation
|
153
|
-
|
152
|
+
if annotation = Fiber.current.annotation
|
153
|
+
# While typically annotations should be strings, that is not always the case.
|
154
|
+
annotation = annotation.to_s
|
155
|
+
|
156
|
+
# If the annotation is empty, we don't want to print it, as it will look like a formatting bug.
|
157
|
+
if annotation.size > 0
|
158
|
+
buffer << ": #{@terminal[:annotation]}#{annotation}#{@terminal.reset}"
|
159
|
+
end
|
154
160
|
end
|
155
161
|
end
|
156
162
|
|
data/lib/console/version.rb
CHANGED
data/readme.md
CHANGED
@@ -18,7 +18,13 @@ When Ruby decided to reverse the order of exception backtraces, I finally gave u
|
|
18
18
|
|
19
19
|
## Usage
|
20
20
|
|
21
|
-
Please see the [project documentation](https://socketry.github.io/console).
|
21
|
+
Please see the [project documentation](https://socketry.github.io/console/) for more details.
|
22
|
+
|
23
|
+
- [Getting Started](https://socketry.github.io/console/guides/getting-started/index) - This guide explains how to use `console` for logging.
|
24
|
+
|
25
|
+
- [Command Line](https://socketry.github.io/console/guides/command-line/index) - This guide explains how the `console` gem can be controlled using environment variables.
|
26
|
+
|
27
|
+
- [Integration](https://socketry.github.io/console/guides/integration/index) - This guide explains how to integrate the `console` output into different systems.
|
22
28
|
|
23
29
|
## Contributing
|
24
30
|
|
@@ -37,3 +43,9 @@ This project uses the [Developer Certificate of Origin](https://developercertifi
|
|
37
43
|
### Contributor Covenant
|
38
44
|
|
39
45
|
This project is governed by [Contributor Covenant](https://www.contributor-covenant.org/). All contributors and participants agree to abide by its terms.
|
46
|
+
|
47
|
+
## See Also
|
48
|
+
|
49
|
+
- [console-adapter-rails](https://github.com/socketry/console-adapter-rails)
|
50
|
+
- [console-adapter-sidekiq](https://github.com/socketry/console-adapter-sidekiq)
|
51
|
+
- [console-output-datadog](https://github.com/socketry/console-output-datadog)
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: console
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.23.
|
4
|
+
version: 1.23.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
@@ -46,7 +46,7 @@ cert_chain:
|
|
46
46
|
Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
|
47
47
|
voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
|
48
48
|
-----END CERTIFICATE-----
|
49
|
-
date: 2023-
|
49
|
+
date: 2023-12-03 00:00:00.000000000 Z
|
50
50
|
dependencies:
|
51
51
|
- !ruby/object:Gem::Dependency
|
52
52
|
name: fiber-annotation
|
@@ -117,7 +117,7 @@ files:
|
|
117
117
|
- lib/console/version.rb
|
118
118
|
- license.md
|
119
119
|
- readme.md
|
120
|
-
homepage: https://github.
|
120
|
+
homepage: https://socketry.github.io/console/
|
121
121
|
licenses:
|
122
122
|
- MIT
|
123
123
|
metadata: {}
|
@@ -136,7 +136,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
136
136
|
- !ruby/object:Gem::Version
|
137
137
|
version: '0'
|
138
138
|
requirements: []
|
139
|
-
rubygems_version: 3.4.
|
139
|
+
rubygems_version: 3.4.22
|
140
140
|
signing_key:
|
141
141
|
specification_version: 4
|
142
142
|
summary: Beautiful logging for Ruby.
|
metadata.gz.sig
CHANGED
Binary file
|