console 1.25.2 → 1.27.0
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 +36 -16
- data/lib/console/event/failure.rb +4 -1
- data/lib/console/output/sensitive.rb +1 -1
- data/lib/console/terminal/formatter/progress.rb +1 -1
- data/lib/console/version.rb +1 -1
- data/license.md +1 -0
- data/readme.md +4 -3
- data.tar.gz.sig +0 -0
- metadata +4 -3
- 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: 93187d6e4774eecaad627306d33a5f38bad4e123e029587d7f142a1265de6ec6
|
4
|
+
data.tar.gz: 9a5015df0b90995173414eecd2b5b6bff60fe07129db4089cad9c86bdbf1e84f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d1bc5192624a8c15f464ceac4c5b7f6b3d4340df8a75aff4f5e20b6b42d340872135538b5abb4dd8a2e34f57048536898dee9e07a2c1a0e2e819a1c34b259cc5
|
7
|
+
data.tar.gz: d61a670deecf0418cd09ed9f1a4d800d2dd5d7b41bd02b3ce2aaa410b27178e62bb7071106a4d7ae89c57fcc4aeadd9ce478a37a1a7859bd20ac00c76c7e1c43
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/console/capture.rb
CHANGED
@@ -9,27 +9,45 @@ module Console
|
|
9
9
|
# A general sink which captures all events into a buffer.
|
10
10
|
class Capture
|
11
11
|
def initialize
|
12
|
-
@
|
12
|
+
@records = []
|
13
13
|
@verbose = false
|
14
14
|
end
|
15
15
|
|
16
|
-
attr :
|
16
|
+
attr :records
|
17
|
+
|
18
|
+
# @deprecated Use {#records} instead of {#buffer}.
|
19
|
+
alias buffer records
|
20
|
+
|
21
|
+
alias to_a records
|
22
|
+
|
17
23
|
attr :verbose
|
18
24
|
|
19
|
-
def
|
20
|
-
@
|
25
|
+
def include?(pattern)
|
26
|
+
@records.any? do |record|
|
27
|
+
record[:subject].to_s&.match?(pattern) or record[:message].to_s&.match?(pattern)
|
28
|
+
end
|
21
29
|
end
|
22
30
|
|
23
|
-
def
|
24
|
-
|
31
|
+
def each(&block)
|
32
|
+
@records.each(&block)
|
33
|
+
end
|
34
|
+
|
35
|
+
include Enumerable
|
36
|
+
|
37
|
+
def first
|
38
|
+
@records.first
|
39
|
+
end
|
40
|
+
|
41
|
+
def last
|
42
|
+
@records.last
|
25
43
|
end
|
26
44
|
|
27
45
|
def clear
|
28
|
-
@
|
46
|
+
@records.clear
|
29
47
|
end
|
30
48
|
|
31
49
|
def empty?
|
32
|
-
@
|
50
|
+
@records.empty?
|
33
51
|
end
|
34
52
|
|
35
53
|
def verbose!(value = true)
|
@@ -41,39 +59,41 @@ module Console
|
|
41
59
|
end
|
42
60
|
|
43
61
|
def call(subject = nil, *arguments, severity: UNKNOWN, event: nil, **options, &block)
|
44
|
-
|
62
|
+
record = {
|
45
63
|
time: ::Time.now.iso8601,
|
46
64
|
severity: severity,
|
47
65
|
**options,
|
48
66
|
}
|
49
67
|
|
50
68
|
if subject
|
51
|
-
|
69
|
+
record[:subject] = subject
|
52
70
|
end
|
53
71
|
|
54
72
|
if event
|
55
|
-
|
73
|
+
record[:event] = event.to_hash
|
56
74
|
end
|
57
75
|
|
58
76
|
if arguments.any?
|
59
|
-
|
77
|
+
record[:arguments] = arguments
|
60
78
|
end
|
61
79
|
|
62
80
|
if annotation = Fiber.current.annotation
|
63
|
-
|
81
|
+
record[:annotation] = annotation
|
64
82
|
end
|
65
83
|
|
66
84
|
if block_given?
|
67
85
|
if block.arity.zero?
|
68
|
-
|
86
|
+
record[:message] = yield
|
69
87
|
else
|
70
88
|
buffer = StringIO.new
|
71
89
|
yield buffer
|
72
|
-
|
90
|
+
record[:message] = buffer.string
|
73
91
|
end
|
92
|
+
else
|
93
|
+
record[:message] = arguments.join(" ")
|
74
94
|
end
|
75
95
|
|
76
|
-
@
|
96
|
+
@records << record
|
77
97
|
end
|
78
98
|
end
|
79
99
|
end
|
@@ -3,6 +3,7 @@
|
|
3
3
|
# Released under the MIT License.
|
4
4
|
# Copyright, 2019-2024, by Samuel Williams.
|
5
5
|
# Copyright, 2021, by Robert Schulze.
|
6
|
+
# Copyright, 2024, by Patrik Wenger.
|
6
7
|
|
7
8
|
require_relative 'generic'
|
8
9
|
|
@@ -27,7 +28,9 @@ module Console
|
|
27
28
|
def self.log(subject, exception, **options)
|
28
29
|
Console.error(subject, **self.for(exception).to_hash, **options)
|
29
30
|
end
|
30
|
-
|
31
|
+
|
32
|
+
attr_reader :exception
|
33
|
+
|
31
34
|
def initialize(exception, root = Dir.getwd)
|
32
35
|
@exception = exception
|
33
36
|
@root = root
|
data/lib/console/version.rb
CHANGED
data/license.md
CHANGED
@@ -10,6 +10,7 @@ Copyright, 2021, by Robert Schulze.
|
|
10
10
|
Copyright, 2022, by Anton Sozontov.
|
11
11
|
Copyright, 2022, by William T. Nelson.
|
12
12
|
Copyright, 2023, by Felix Yan.
|
13
|
+
Copyright, 2024, by Patrik Wenger.
|
13
14
|
|
14
15
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
15
16
|
of this software and associated documentation files (the "Software"), to deal
|
data/readme.md
CHANGED
@@ -38,14 +38,15 @@ We welcome contributions to this project.
|
|
38
38
|
|
39
39
|
### Developer Certificate of Origin
|
40
40
|
|
41
|
-
|
41
|
+
In order to protect users of this project, we require all contributors to comply with the [Developer Certificate of Origin](https://developercertificate.org/). This ensures that all contributions are properly licensed and attributed.
|
42
42
|
|
43
|
-
###
|
43
|
+
### Community Guidelines
|
44
44
|
|
45
|
-
This project is
|
45
|
+
This project is best served by a collaborative and respectful environment. Treat each other professionally, respect differing viewpoints, and engage constructively. Harassment, discrimination, or harmful behavior is not tolerated. Communicate clearly, listen actively, and support one another. If any issues arise, please inform the project maintainers.
|
46
46
|
|
47
47
|
## See Also
|
48
48
|
|
49
49
|
- [console-adapter-rails](https://github.com/socketry/console-adapter-rails)
|
50
50
|
- [console-adapter-sidekiq](https://github.com/socketry/console-adapter-sidekiq)
|
51
51
|
- [console-output-datadog](https://github.com/socketry/console-output-datadog)
|
52
|
+
- [sus-fixtures-console](https://github.com/sus-rb/sus-fixtures-console)
|
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.
|
4
|
+
version: 1.27.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
@@ -13,6 +13,7 @@ authors:
|
|
13
13
|
- Cédric Boutillier
|
14
14
|
- Felix Yan
|
15
15
|
- Olle Jonsson
|
16
|
+
- Patrik Wenger
|
16
17
|
- William T. Nelson
|
17
18
|
autorequire:
|
18
19
|
bindir: bin
|
@@ -46,7 +47,7 @@ cert_chain:
|
|
46
47
|
Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
|
47
48
|
voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
|
48
49
|
-----END CERTIFICATE-----
|
49
|
-
date: 2024-
|
50
|
+
date: 2024-07-18 00:00:00.000000000 Z
|
50
51
|
dependencies:
|
51
52
|
- !ruby/object:Gem::Dependency
|
52
53
|
name: fiber-annotation
|
@@ -149,7 +150,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
149
150
|
- !ruby/object:Gem::Version
|
150
151
|
version: '0'
|
151
152
|
requirements: []
|
152
|
-
rubygems_version: 3.5.
|
153
|
+
rubygems_version: 3.5.11
|
153
154
|
signing_key:
|
154
155
|
specification_version: 4
|
155
156
|
summary: Beautiful logging for Ruby.
|
metadata.gz.sig
CHANGED
Binary file
|