console 1.27.0 → 1.28.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/bake/console.rb +3 -3
- data/lib/console/capture.rb +1 -1
- data/lib/console/compatible/logger.rb +1 -1
- data/lib/console/event/failure.rb +2 -2
- data/lib/console/event/spawn.rb +2 -2
- data/lib/console/event.rb +2 -2
- data/lib/console/filter.rb +1 -1
- data/lib/console/format/safe.rb +2 -2
- data/lib/console/format.rb +1 -1
- data/lib/console/logger.rb +8 -8
- data/lib/console/output/default.rb +2 -2
- data/lib/console/output/sensitive.rb +1 -1
- data/lib/console/output/serialized.rb +3 -3
- data/lib/console/output/terminal.rb +7 -7
- data/lib/console/output.rb +6 -6
- data/lib/console/progress.rb +1 -1
- data/lib/console/resolver.rb +5 -5
- data/lib/console/terminal/text.rb +1 -1
- data/lib/console/terminal/xterm.rb +2 -2
- data/lib/console/terminal.rb +5 -5
- data/lib/console/version.rb +1 -1
- data/lib/console/warn.rb +31 -0
- data/lib/console.rb +3 -2
- data/readme.md +2 -0
- data/releases.md +5 -0
- data.tar.gz.sig +0 -0
- metadata +4 -2
- 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: cf762e4b31732049aa1f34fcc17bdb2430489efd671c74f435bfa214ef6290a5
|
4
|
+
data.tar.gz: 97ba24a40404eebfd1e2bf6544a673b5131628167ff82e7c933a05322ae5e0bf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d0c1e8fec40b694b8d98f37a4525017e45171160338272c4ca586b58d62575f117e8a36b80226246c43a8476b66d354d56650af70aa96f00489ba8dc8e7e8963
|
7
|
+
data.tar.gz: f2f2197d633d2427c4ac9b29706fe59555bbf16bfce0036470c265c0acc86dab8d52884fc844eb7f041ba29c7c330f9d341cbd813859fe4297f59decb56716d7
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/bake/console.rb
CHANGED
@@ -1,18 +1,18 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# Released under the MIT License.
|
4
|
-
# Copyright, 2020-
|
4
|
+
# Copyright, 2020-2024, by Samuel Williams.
|
5
5
|
|
6
6
|
# Increase the verbosity of the logger to info.
|
7
7
|
def info
|
8
|
-
require_relative
|
8
|
+
require_relative "../lib/console"
|
9
9
|
|
10
10
|
Console.logger.info!
|
11
11
|
end
|
12
12
|
|
13
13
|
# Increase the verbosity of the logger to debug.
|
14
14
|
def debug
|
15
|
-
require_relative
|
15
|
+
require_relative "../lib/console"
|
16
16
|
|
17
17
|
Console.logger.debug!
|
18
18
|
end
|
data/lib/console/capture.rb
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
# Copyright, 2021, by Robert Schulze.
|
6
6
|
# Copyright, 2024, by Patrik Wenger.
|
7
7
|
|
8
|
-
require_relative
|
8
|
+
require_relative "generic"
|
9
9
|
|
10
10
|
module Console
|
11
11
|
module Event
|
@@ -59,7 +59,7 @@ module Console
|
|
59
59
|
message = exception.detailed_message
|
60
60
|
|
61
61
|
# We want to remove the trailling exception class as we format it differently:
|
62
|
-
message.sub!(/\s*\(.*?\)$/,
|
62
|
+
message.sub!(/\s*\(.*?\)$/, "")
|
63
63
|
|
64
64
|
hash[:message] = message
|
65
65
|
else
|
data/lib/console/event/spawn.rb
CHANGED
data/lib/console/event.rb
CHANGED
data/lib/console/filter.rb
CHANGED
@@ -10,7 +10,7 @@ module Console
|
|
10
10
|
UNKNOWN = :unknown
|
11
11
|
|
12
12
|
class Filter
|
13
|
-
if Object.const_defined?(:Ractor) and RUBY_VERSION >=
|
13
|
+
if Object.const_defined?(:Ractor) and RUBY_VERSION >= "3.1"
|
14
14
|
def self.define_immutable_method(name, &block)
|
15
15
|
block = Ractor.make_shareable(block)
|
16
16
|
self.define_method(name, &block)
|
data/lib/console/format/safe.rb
CHANGED
data/lib/console/format.rb
CHANGED
data/lib/console/logger.rb
CHANGED
@@ -5,13 +5,13 @@
|
|
5
5
|
# Copyright, 2021, by Bryan Powell.
|
6
6
|
# Copyright, 2021, by Robert Schulze.
|
7
7
|
|
8
|
-
require_relative
|
9
|
-
require_relative
|
10
|
-
require_relative
|
11
|
-
require_relative
|
12
|
-
require_relative
|
8
|
+
require_relative "output"
|
9
|
+
require_relative "filter"
|
10
|
+
require_relative "event"
|
11
|
+
require_relative "resolver"
|
12
|
+
require_relative "progress"
|
13
13
|
|
14
|
-
require
|
14
|
+
require "fiber/local"
|
15
15
|
|
16
16
|
module Console
|
17
17
|
class Logger < Filter[debug: 0, info: 1, warn: 2, error: 3, fatal: 4]
|
@@ -21,7 +21,7 @@ module Console
|
|
21
21
|
# You can also specify CONSOLE_LEVEL=debug or CONSOLE_LEVEL=info in environment.
|
22
22
|
# https://mislav.net/2011/06/ruby-verbose-mode/ has more details about how it all fits together.
|
23
23
|
def self.default_log_level(env = ENV)
|
24
|
-
if level = env[
|
24
|
+
if level = env["CONSOLE_LEVEL"]
|
25
25
|
LEVELS[level.to_sym] || level.to_i
|
26
26
|
elsif $DEBUG
|
27
27
|
DEBUG
|
@@ -34,7 +34,7 @@ module Console
|
|
34
34
|
|
35
35
|
# Controls verbose output using `$VERBOSE`.
|
36
36
|
def self.verbose?(env = ENV)
|
37
|
-
!$VERBOSE.nil? || env[
|
37
|
+
!$VERBOSE.nil? || env["CONSOLE_VERBOSE"]
|
38
38
|
end
|
39
39
|
|
40
40
|
def self.default_logger(output = $stderr, env = ENV, **options)
|
@@ -3,9 +3,9 @@
|
|
3
3
|
# Released under the MIT License.
|
4
4
|
# Copyright, 2019-2024, by Samuel Williams.
|
5
5
|
|
6
|
-
require_relative
|
7
|
-
require
|
8
|
-
require
|
6
|
+
require_relative "../format"
|
7
|
+
require "time"
|
8
|
+
require "fiber/annotation"
|
9
9
|
|
10
10
|
module Console
|
11
11
|
module Output
|
@@ -4,13 +4,13 @@
|
|
4
4
|
# Copyright, 2019-2024, by Samuel Williams.
|
5
5
|
# Copyright, 2021, by Robert Schulze.
|
6
6
|
|
7
|
-
require_relative
|
8
|
-
require_relative
|
7
|
+
require_relative "../clock"
|
8
|
+
require_relative "../terminal"
|
9
9
|
|
10
|
-
require
|
11
|
-
require
|
12
|
-
require
|
13
|
-
require
|
10
|
+
require "json"
|
11
|
+
require "fiber"
|
12
|
+
require "fiber/annotation"
|
13
|
+
require "stringio"
|
14
14
|
|
15
15
|
module Console
|
16
16
|
module Output
|
@@ -35,7 +35,7 @@ module Console
|
|
35
35
|
end
|
36
36
|
|
37
37
|
# This, and all related methods, is considered private.
|
38
|
-
CONSOLE_START_AT =
|
38
|
+
CONSOLE_START_AT = "CONSOLE_START_AT"
|
39
39
|
|
40
40
|
# Exports CONSOLE_START which can be used to synchronize the start times of all child processes when they log using delta time.
|
41
41
|
def self.start_at!(environment = ENV)
|
data/lib/console/output.rb
CHANGED
@@ -3,16 +3,16 @@
|
|
3
3
|
# Released under the MIT License.
|
4
4
|
# Copyright, 2021-2024, by Samuel Williams.
|
5
5
|
|
6
|
-
require_relative
|
7
|
-
require_relative
|
8
|
-
require_relative
|
9
|
-
require_relative
|
6
|
+
require_relative "output/default"
|
7
|
+
require_relative "output/serialized"
|
8
|
+
require_relative "output/terminal"
|
9
|
+
require_relative "output/null"
|
10
10
|
|
11
11
|
module Console
|
12
12
|
module Output
|
13
13
|
def self.new(output = nil, env = ENV, **options)
|
14
|
-
if names = env[
|
15
|
-
names = names.split(
|
14
|
+
if names = env["CONSOLE_OUTPUT"]
|
15
|
+
names = names.split(",").reverse
|
16
16
|
|
17
17
|
names.inject(output) do |output, name|
|
18
18
|
Output.const_get(name).new(output, **options)
|
data/lib/console/progress.rb
CHANGED
data/lib/console/resolver.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# Released under the MIT License.
|
4
|
-
# Copyright, 2019-
|
4
|
+
# Copyright, 2019-2024, by Samuel Williams.
|
5
5
|
# Copyright, 2021, by Robert Schulze.
|
6
6
|
|
7
|
-
require_relative
|
7
|
+
require_relative "filter"
|
8
8
|
|
9
9
|
module Console
|
10
10
|
class Resolver
|
@@ -22,12 +22,12 @@ module Console
|
|
22
22
|
def self.default_resolver(logger, env = ENV)
|
23
23
|
# Find all CONSOLE_$LEVEL variables from environment:
|
24
24
|
levels = logger.class::LEVELS
|
25
|
-
.map{|label, level| [level, env["CONSOLE_#{label.upcase}"]&.split(
|
25
|
+
.map{|label, level| [level, env["CONSOLE_#{label.upcase}"]&.split(",")]}
|
26
26
|
.to_h
|
27
27
|
.compact
|
28
28
|
|
29
|
-
off_klasses = env[
|
30
|
-
on_klasses = env[
|
29
|
+
off_klasses = env["CONSOLE_OFF"]&.split(",")
|
30
|
+
on_klasses = env["CONSOLE_ON"]&.split(",")
|
31
31
|
|
32
32
|
resolver = nil
|
33
33
|
|
data/lib/console/terminal.rb
CHANGED
@@ -3,12 +3,12 @@
|
|
3
3
|
# Released under the MIT License.
|
4
4
|
# Copyright, 2019-2024, by Samuel Williams.
|
5
5
|
|
6
|
-
require_relative
|
7
|
-
require_relative
|
6
|
+
require_relative "terminal/text"
|
7
|
+
require_relative "terminal/xterm"
|
8
8
|
|
9
|
-
require_relative
|
10
|
-
require_relative
|
11
|
-
require_relative
|
9
|
+
require_relative "terminal/formatter/progress"
|
10
|
+
require_relative "terminal/formatter/failure"
|
11
|
+
require_relative "terminal/formatter/spawn"
|
12
12
|
|
13
13
|
module Console
|
14
14
|
module Terminal
|
data/lib/console/version.rb
CHANGED
data/lib/console/warn.rb
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Released under the MIT License.
|
4
|
+
# Copyright, 2024, by Samuel Williams.
|
5
|
+
|
6
|
+
module Console
|
7
|
+
# Whether the current fiber is emitting a warning.
|
8
|
+
Fiber.attr_accessor :console_warn
|
9
|
+
|
10
|
+
module Warn
|
11
|
+
def warn(*arguments, uplevel: nil, **options)
|
12
|
+
fiber = Fiber.current
|
13
|
+
|
14
|
+
# We do this to be extra pendantic about avoiding infinite recursion, i.e. if `Console.warn` some how calls `Kernel.warn` again, it would potentially cause infinite recursion. I'm not sure if this is a problem in practice, but I'd rather not find out the hard way...
|
15
|
+
return super if fiber.console_warn
|
16
|
+
|
17
|
+
if uplevel
|
18
|
+
options[:backtrace] = caller(uplevel, 1)
|
19
|
+
end
|
20
|
+
|
21
|
+
begin
|
22
|
+
fiber.console_warn = true
|
23
|
+
Console.warn(*arguments, **options)
|
24
|
+
ensure
|
25
|
+
fiber.console_warn = false
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
::Kernel.prepend(Warn)
|
31
|
+
end
|
data/lib/console.rb
CHANGED
@@ -6,8 +6,9 @@
|
|
6
6
|
# Copyright, 2020, by Michael Adams.
|
7
7
|
# Copyright, 2021, by Cédric Boutillier.
|
8
8
|
|
9
|
-
require_relative
|
10
|
-
require_relative
|
9
|
+
require_relative "console/version"
|
10
|
+
require_relative "console/logger"
|
11
|
+
require_relative "console/warn"
|
11
12
|
|
12
13
|
module Console
|
13
14
|
class << self
|
data/readme.md
CHANGED
@@ -26,6 +26,8 @@ Please see the [project documentation](https://socketry.github.io/console/) for
|
|
26
26
|
|
27
27
|
- [Integration](https://socketry.github.io/console/guides/integration/index) - This guide explains how to integrate the `console` output into different systems.
|
28
28
|
|
29
|
+
- [Events](https://socketry.github.io/console/guides/events/index) - This guide explains how to log structured events with a well-defined schema.
|
30
|
+
|
29
31
|
## Contributing
|
30
32
|
|
31
33
|
We welcome contributions to this project.
|
data/releases.md
ADDED
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.28.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
@@ -47,7 +47,7 @@ cert_chain:
|
|
47
47
|
Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
|
48
48
|
voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
|
49
49
|
-----END CERTIFICATE-----
|
50
|
-
date: 2024-
|
50
|
+
date: 2024-11-05 00:00:00.000000000 Z
|
51
51
|
dependencies:
|
52
52
|
- !ruby/object:Gem::Dependency
|
53
53
|
name: fiber-annotation
|
@@ -128,8 +128,10 @@ files:
|
|
128
128
|
- lib/console/terminal/text.rb
|
129
129
|
- lib/console/terminal/xterm.rb
|
130
130
|
- lib/console/version.rb
|
131
|
+
- lib/console/warn.rb
|
131
132
|
- license.md
|
132
133
|
- readme.md
|
134
|
+
- releases.md
|
133
135
|
homepage: https://socketry.github.io/console
|
134
136
|
licenses:
|
135
137
|
- MIT
|
metadata.gz.sig
CHANGED
Binary file
|