console 1.29.2 → 1.36.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.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data/context/command-line.md +47 -0
  4. data/context/configuration.md +23 -0
  5. data/context/events.md +71 -0
  6. data/context/getting-started.md +170 -0
  7. data/context/index.yaml +28 -0
  8. data/context/integration.md +37 -0
  9. data/lib/console/capture.rb +29 -3
  10. data/lib/console/clock.rb +9 -3
  11. data/lib/console/compatible/logger.rb +34 -3
  12. data/lib/console/config.rb +96 -0
  13. data/lib/console/event/failure.rb +33 -4
  14. data/lib/console/event/generic.rb +22 -1
  15. data/lib/console/event/spawn.rb +39 -7
  16. data/lib/console/event.rb +7 -1
  17. data/lib/console/filter.rb +83 -7
  18. data/lib/console/format/safe.rb +205 -58
  19. data/lib/console/format.rb +5 -1
  20. data/lib/console/interface.rb +18 -10
  21. data/lib/console/logger.rb +25 -38
  22. data/lib/console/output/default.rb +31 -6
  23. data/lib/console/output/failure.rb +9 -2
  24. data/lib/console/output/null.rb +5 -2
  25. data/lib/console/output/sensitive.rb +42 -1
  26. data/lib/console/output/serialized.rb +32 -7
  27. data/lib/console/output/split.rb +12 -1
  28. data/lib/console/output/terminal.rb +68 -15
  29. data/lib/console/output/wrapper.rb +12 -1
  30. data/lib/console/output.rb +14 -3
  31. data/lib/console/progress.rb +56 -9
  32. data/lib/console/resolver.rb +19 -2
  33. data/lib/console/terminal/formatter/failure.rb +18 -6
  34. data/lib/console/terminal/formatter/progress.rb +16 -3
  35. data/lib/console/terminal/formatter/spawn.rb +16 -5
  36. data/lib/console/terminal/formatter.rb +16 -0
  37. data/lib/console/terminal/text.rb +66 -20
  38. data/lib/console/terminal/xterm.rb +18 -3
  39. data/lib/console/terminal.rb +7 -9
  40. data/lib/console/version.rb +2 -2
  41. data/lib/console/warn.rb +2 -2
  42. data/lib/console.rb +2 -1
  43. data/license.md +6 -3
  44. data/readme.md +60 -6
  45. data/releases.md +115 -1
  46. data.tar.gz.sig +0 -0
  47. metadata +20 -12
  48. metadata.gz.sig +0 -0
data/releases.md CHANGED
@@ -1,11 +1,125 @@
1
1
  # Releases
2
2
 
3
+ ## v1.36.0
4
+
5
+ - Add a `size_limit` to `Console::Format::Safe` (default 16KiB) which rebuilds oversized records field-by-field, keeping as many top-level fields as fit within the limit.
6
+ - Degraded fields are recorded in a `truncated` object that maps each field name to why it was truncated: `true` (dropped for size) or the error (the value could not be serialized directly and a safe representation was kept in its place).
7
+ - Rename `Console::Format::Safe`'s `limit:` to `depth_limit:` (with a deprecated `limit:` alias) to clarify its purpose alongside the new `size_limit:`.
8
+
9
+ ## v1.35.0
10
+
11
+ - Fix handling of `Errno::ENODEV` errors when calculating the width of a terminal that was been re-opened to `File::NULL`.
12
+
13
+ ## v1.34.1
14
+
15
+ - Add `process_id` to serialized output records for clarity (`pid` is still included for backwards compatibility).
16
+ - Add `object_id` to serialized output records **only** when the subject is not a string or class/module.
17
+
18
+ ## v1.34.0
19
+
20
+ - Allow `Console::Compatible::Logger#add` to accept `**options`.
21
+
22
+ ## v1.32.0
23
+
24
+ - Add `fiber_id` to serialized output records to help identify which fiber logged the message.
25
+ - Ractor support appears broken in older Ruby versions, so we now require Ruby 3.4 or later for Ractor compatibility, if you need Ractor support.
26
+
27
+ ## v1.31.0
28
+
29
+ ### Ractor compatibility.
30
+
31
+ The console library now works correctly with Ruby's Ractor concurrency model. Previously, attempting to use console logging within Ractors would fail with errors about non-shareable objects. This has been fixed by ensuring the default configuration is properly frozen.
32
+
33
+ ``` ruby
34
+ # This now works without errors:
35
+ ractor = Ractor.new do
36
+ require "console"
37
+ Console.info("Hello from Ractor!")
38
+ "Ractor completed successfully"
39
+ end
40
+
41
+ result = ractor.take
42
+ puts result # => 'Ractor completed successfully'
43
+ ```
44
+
45
+ The fix is minimal and maintains full backward compatibility while enabling safe parallel logging across multiple Ractors.
46
+
47
+ ### Symbol log level compatibility.
48
+
49
+ Previously, returning symbols from custom `log_level` methods in configuration files would cause runtime errors like "comparison of Integer with :debug failed". This has been fixed to properly convert symbols to their corresponding integer values.
50
+
51
+ ``` ruby
52
+ # config/console.rb - This now works correctly:
53
+ def log_level(env = ENV)
54
+ :debug # Automatically converted to Console::Logger::LEVELS[:debug]
55
+ end
56
+ ```
57
+
58
+ While this fix maintains backward compatibility, the recommended approach is still to use integer values directly:
59
+
60
+ ``` ruby
61
+ # config/console.rb - Recommended approach:
62
+ def log_level(env = ENV)
63
+ Console::Logger::LEVELS[:debug] # Returns 0
64
+ end
65
+ ```
66
+
67
+ ### Improved output format selection for cron jobs and email contexts.
68
+
69
+ When `MAILTO` environment variable is set (typically in cron jobs), the console library now prefers human-readable terminal output instead of JSON serialized output, even when the output stream is not a TTY. This ensures that cron job output sent via email is formatted in a readable way for administrators.
70
+
71
+ ``` ruby
72
+ # Previously in cron jobs (non-TTY), this would output JSON:
73
+ # {"time":"2025-06-07T10:30:00Z","severity":"info","subject":"CronJob","message":["Task completed"]}
74
+
75
+ # Now with MAILTO set, it outputs human-readable format:
76
+ # 0.1s info: CronJob
77
+ # | Task completed
78
+ ```
79
+
80
+ This change is conservative and only affects environments where `MAILTO` is explicitly set, ensuring compatibility with existing deployments.
81
+
82
+ ## v1.30.0
83
+
84
+ ### Introduce `Console::Config` for fine grained configuration.
85
+
86
+ Introduced a new explicit configuration interface via config/console.rb to enhance logging setup in complex applications. This update gives the application code an opportunity to load files if required and control aspects such as log level, output, and more. Users can override default behaviors (e.g., make\_output, make\_logger, and log\_level) for improved customization.
87
+
88
+ ``` ruby
89
+ # config/console.rb
90
+ def log_level(env = ENV)
91
+ # Set a custom log level, e.g., force debug mode:
92
+ :debug
93
+ end
94
+
95
+ def make_logger(output = $stderr, env = ENV, **options)
96
+ # Custom logger configuration with verbose output:
97
+ options[:verbose] = true
98
+
99
+ Logger.new(output, **options)
100
+ end
101
+ ```
102
+
103
+ This approach provides a standard way to hook into the log setup process, allowing tailored adjustments for reliable and customizable logging behavior.
104
+
105
+ ## v1.29.3
106
+
107
+ - Serialized output now uses `IO#write` with a single string to reduce the chance of interleaved output.
108
+
109
+ ## v1.29.2
110
+
111
+ - Always return `nil` from `Console::Filter` logging methods.
112
+
113
+ ## v1.29.1
114
+
115
+ - Fix logging `exception:` keyword argument when the value was not an exception.
116
+
3
117
  ## v1.29.0
4
118
 
5
119
  - Don't make `Kernel#warn` redirection to `Console.warn` the default behavior, you must `require 'console/warn'` to enable it.
6
120
  - Remove deprecated `Console::Logger#failure`.
7
121
 
8
- ### Consistent Handling of Exceptions
122
+ ### Consistent handling of exceptions.
9
123
 
10
124
  `Console.call` and all wrapper methods will now consistently handle exceptions that are the last positional argument or keyword argument. This means that the following code will work as expected:
11
125
 
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,21 +1,23 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: console
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.29.2
4
+ version: 1.36.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
8
8
  - Robert Schulze
9
9
  - Bryan Powell
10
10
  - Michael Adams
11
+ - Patrik Wenger
12
+ - William T. Nelson
11
13
  - Anton Sozontov
14
+ - Copilot
12
15
  - Cyril Roelandt
13
16
  - Cédric Boutillier
14
17
  - Felix Yan
15
18
  - Olle Jonsson
16
- - Patrik Wenger
17
- - William T. Nelson
18
- autorequire:
19
+ - Shigeru Nakajima
20
+ - Yasha Krasnou
19
21
  bindir: bin
20
22
  cert_chain:
21
23
  - |
@@ -47,7 +49,7 @@ cert_chain:
47
49
  Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
48
50
  voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
49
51
  -----END CERTIFICATE-----
50
- date: 2024-12-09 00:00:00.000000000 Z
52
+ date: 1980-01-02 00:00:00.000000000 Z
51
53
  dependencies:
52
54
  - !ruby/object:Gem::Dependency
53
55
  name: fiber-annotation
@@ -91,18 +93,23 @@ dependencies:
91
93
  - - ">="
92
94
  - !ruby/object:Gem::Version
93
95
  version: '0'
94
- description:
95
- email:
96
96
  executables: []
97
97
  extensions: []
98
98
  extra_rdoc_files: []
99
99
  files:
100
100
  - bake/console.rb
101
+ - context/command-line.md
102
+ - context/configuration.md
103
+ - context/events.md
104
+ - context/getting-started.md
105
+ - context/index.yaml
106
+ - context/integration.md
101
107
  - lib/console.rb
102
108
  - lib/console/adapter.rb
103
109
  - lib/console/capture.rb
104
110
  - lib/console/clock.rb
105
111
  - lib/console/compatible/logger.rb
112
+ - lib/console/config.rb
106
113
  - lib/console/event.rb
107
114
  - lib/console/event/failure.rb
108
115
  - lib/console/event/generic.rb
@@ -124,6 +131,7 @@ files:
124
131
  - lib/console/progress.rb
125
132
  - lib/console/resolver.rb
126
133
  - lib/console/terminal.rb
134
+ - lib/console/terminal/formatter.rb
127
135
  - lib/console/terminal/formatter/failure.rb
128
136
  - lib/console/terminal/formatter/progress.rb
129
137
  - lib/console/terminal/formatter/spawn.rb
@@ -134,12 +142,13 @@ files:
134
142
  - license.md
135
143
  - readme.md
136
144
  - releases.md
137
- homepage: https://socketry.github.io/console
145
+ homepage: https://github.com/socketry/console
138
146
  licenses:
139
147
  - MIT
140
148
  metadata:
141
149
  documentation_uri: https://socketry.github.io/console/
142
- post_install_message:
150
+ funding_uri: https://github.com/sponsors/ioquatix/
151
+ source_code_uri: https://github.com/socketry/console.git
143
152
  rdoc_options: []
144
153
  require_paths:
145
154
  - lib
@@ -147,15 +156,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
147
156
  requirements:
148
157
  - - ">="
149
158
  - !ruby/object:Gem::Version
150
- version: '3.1'
159
+ version: '3.3'
151
160
  required_rubygems_version: !ruby/object:Gem::Requirement
152
161
  requirements:
153
162
  - - ">="
154
163
  - !ruby/object:Gem::Version
155
164
  version: '0'
156
165
  requirements: []
157
- rubygems_version: 3.5.22
158
- signing_key:
166
+ rubygems_version: 4.0.10
159
167
  specification_version: 4
160
168
  summary: Beautiful logging for Ruby.
161
169
  test_files: []
metadata.gz.sig CHANGED
Binary file