console 1.32.0 → 1.34.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 51db72e147d6bbe3aa01e48b78ebc454cb34a719be4f936b58542c5623fb803d
4
- data.tar.gz: 4ca2801323f3ee8149e6d967d1fe8920aff5958db3a6b37980251fde3e51fc61
3
+ metadata.gz: a17ad8efc3e6a03b2da82f6de8e1964ebbced255ed80a8ccc91bf5973a025ee1
4
+ data.tar.gz: dce3c6fa4e1efac9f2d38623fecbb52d2a88f03c3547105d112c3a13c46a8c7b
5
5
  SHA512:
6
- metadata.gz: 42b590f516d239a57d796b5ac8a8c3f3a40da40bc3430e0a797940ffa3f2bbaa47be07c3943ce9df1a94121ea70288c41615f7b71d166094e43bde91681ac1c4
7
- data.tar.gz: 17fa1288f63cdb231f5c1c91e10098550b3418d6d2c1743939a15d5380d7fc68c7a95997327b417a28686bb0b9784196ce832615b2cd1d98bedf65cb29360c57
6
+ metadata.gz: bd9ee32eb63f0516bac970ea2bfa207c41f59fb7a05d3762bfd9e84b0b72d7e13628ffdb4ad5cdd33f280217064830dacc053abec3052f818b65135a432f4c68
7
+ data.tar.gz: 24de30d8f9a3480a66b9c72b740cf7db0e326946c3d81fd09266fc71f282ffbfedea5fa5bb40c4ee3847673cb5ca58422e85250b0fdb7a52cfb2474beee7b65b
checksums.yaml.gz.sig CHANGED
Binary file
@@ -62,7 +62,7 @@ module Console
62
62
  # @parameter message [String] The message to log.
63
63
  # @parameter progname [String] The program name.
64
64
  # @returns [Boolean] True if the message was logged.
65
- def add(severity, message = nil, progname = nil)
65
+ def add(severity, message = nil, progname = nil, **options)
66
66
  severity ||= UNKNOWN
67
67
 
68
68
  if @logdev.nil? or severity < level
@@ -84,6 +84,7 @@ module Console
84
84
 
85
85
  @logdev.call(
86
86
  progname, message,
87
+ **options,
87
88
  severity: format_severity(severity)
88
89
  )
89
90
 
@@ -20,8 +20,12 @@ module Console
20
20
  def self.new(stream, env: ENV, **options)
21
21
  stream ||= $stderr
22
22
 
23
- if stream.tty? || mail?(env)
23
+ if stream.tty?
24
24
  output = Terminal.new(stream, **options)
25
+ elsif self.mail?(env)
26
+ output = Text.new(stream, **options)
27
+ elsif self.github_actions?(env)
28
+ output = XTerm.new(stream, **options)
25
29
  else
26
30
  output = Serialized.new(stream, **options)
27
31
  end
@@ -34,10 +38,13 @@ module Console
34
38
  # Detect if we're running in a cron job or mail context where human-readable output is preferred.
35
39
  # Cron jobs often have MAILTO set and lack TERM, or have minimal TERM values.
36
40
  def self.mail?(env = ENV)
37
- # Check for common cron environment indicators
38
- return true if env.key?("MAILTO") && !env["MAILTO"].empty?
39
-
40
- false
41
+ env.key?("MAILTO") && !env["MAILTO"].empty?
42
+ end
43
+
44
+ # Detect if we're running in GitHub Actions, where human-readable output is preferred.
45
+ # GitHub Actions sets the GITHUB_ACTIONS environment variable to "true".
46
+ def self.github_actions?(env = ENV)
47
+ env["GITHUB_ACTIONS"] == "true"
41
48
  end
42
49
  end
43
50
  end
@@ -26,10 +26,10 @@ module Console
26
26
  names = names.split(",").reverse
27
27
 
28
28
  names.inject(output) do |output, name|
29
- Output.const_get(name).new(output, **options)
29
+ Output.const_get(name).new(output, env: env, **options)
30
30
  end
31
31
  else
32
- return Output::Default.new(output, **options)
32
+ return Output::Default.new(output, env: env, **options)
33
33
  end
34
34
  end
35
35
  end
@@ -4,5 +4,5 @@
4
4
  # Copyright, 2019-2025, by Samuel Williams.
5
5
 
6
6
  module Console
7
- VERSION = "1.32.0"
7
+ VERSION = "1.34.0"
8
8
  end
data/readme.md CHANGED
@@ -34,6 +34,10 @@ Please see the [project documentation](https://socketry.github.io/console/) for
34
34
 
35
35
  Please see the [project releases](https://socketry.github.io/console/releases/index) for all releases.
36
36
 
37
+ ### v1.34.0
38
+
39
+ - Allow `Console::Compatible::Logger#add` to accept `**options`.
40
+
37
41
  ### v1.32.0
38
42
 
39
43
  - Add `fiber_id` to serialized output records to help identify which fiber logged the message.
data/releases.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Releases
2
2
 
3
+ ## v1.34.0
4
+
5
+ - Allow `Console::Compatible::Logger#add` to accept `**options`.
6
+
3
7
  ## v1.32.0
4
8
 
5
9
  - Add `fiber_id` to serialized output records to help identify which fiber logged the message.
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.32.0
4
+ version: 1.34.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
@@ -153,7 +153,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
153
153
  - !ruby/object:Gem::Version
154
154
  version: '0'
155
155
  requirements: []
156
- rubygems_version: 3.6.7
156
+ rubygems_version: 3.7.0.dev
157
157
  specification_version: 4
158
158
  summary: Beautiful logging for Ruby.
159
159
  test_files: []
metadata.gz.sig CHANGED
Binary file