cabin 0.9.0 → 0.9.1
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 +5 -5
- data/CHANGELIST +5 -0
- data/lib/cabin/channel.rb +1 -2
- data/lib/cabin/mixins/logger.rb +4 -4
- data/test/cabin/test_logging.rb +3 -0
- data/test/test_helper.rb +0 -3
- metadata +3 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 6d0845e32e53d78370533bf23f12f0ae300c3cf738f0e9da3d453665a8b5e5fe
|
4
|
+
data.tar.gz: 116f7f71cd5f1d983bb8c84d8171962ac0d70afd0828ad1302f8b3323f740fe3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a79b9592d8685bee38ab1f57770bb7436e4f988fbaa1c1bbaea958e9b292b56b41c3694ead10a3deec03355b434cddefa3ba281a2e94ec13dd946657b3ef813b
|
7
|
+
data.tar.gz: 74da36f2241a269381bd12bc9c9422541299e0e17fe0e6d4b9779ec10a629b5881a2a357831c2c2d3045d0a2cd22c6d7e12d65d315bdcf3b2c2197a6dae06ea6
|
data/CHANGELIST
CHANGED
data/lib/cabin/channel.rb
CHANGED
@@ -9,7 +9,6 @@ require "cabin/outputs/stdlib-logger"
|
|
9
9
|
require "cabin/outputs/io"
|
10
10
|
require "cabin/subscriber"
|
11
11
|
require "cabin/metrics"
|
12
|
-
require "logger" # stdlib
|
13
12
|
require "thread"
|
14
13
|
|
15
14
|
# A wonderful channel for logging.
|
@@ -135,7 +134,7 @@ class Cabin::Channel
|
|
135
134
|
# Returns a subscription id you can use later to unsubscribe
|
136
135
|
def subscribe(output, options = {})
|
137
136
|
# Wrap ruby stdlib Logger if given.
|
138
|
-
if output.is_a?(::Logger)
|
137
|
+
if Kernel.const_defined?(:Logger) && output.is_a?(::Logger)
|
139
138
|
output = Cabin::Outputs::StdlibLogger.new(output)
|
140
139
|
elsif output.is_a?(::IO)
|
141
140
|
output = Cabin::Outputs::IO.new(output)
|
data/lib/cabin/mixins/logger.rb
CHANGED
@@ -20,7 +20,8 @@ module Cabin::Mixins::Logger
|
|
20
20
|
:error => 1,
|
21
21
|
:warn => 2,
|
22
22
|
:info => 3,
|
23
|
-
:debug => 4
|
23
|
+
:debug => 4,
|
24
|
+
:trace => 5
|
24
25
|
}
|
25
26
|
|
26
27
|
BACKTRACE_RE = /([^:]+):([0-9]+)(?::in `(.*)')?/
|
@@ -37,15 +38,14 @@ module Cabin::Mixins::Logger
|
|
37
38
|
# Each level-based method accepts both a message and a hash data.
|
38
39
|
#
|
39
40
|
# This will define methods such as 'fatal' and 'fatal?' for each
|
40
|
-
# of: fatal, error, warn, info, debug
|
41
|
+
# of: fatal, error, warn, info, debug, trace
|
41
42
|
#
|
42
43
|
# The first method type (ie Cabin::Channel#fatal) is what logs, and it takes a
|
43
44
|
# message and an optional Hash with context.
|
44
45
|
#
|
45
46
|
# The second method type (ie; Cabin::Channel#fatal?) returns true if
|
46
47
|
# fatal logs are being emitted, false otherwise.
|
47
|
-
|
48
|
-
level = level.to_sym
|
48
|
+
LEVELS.keys.each do |level|
|
49
49
|
predicate = "#{level}?".to_sym
|
50
50
|
|
51
51
|
# def info, def warn, etc...
|
data/test/cabin/test_logging.rb
CHANGED
@@ -67,6 +67,7 @@ describe Cabin::Channel do
|
|
67
67
|
sub2 = Receiver.new
|
68
68
|
@logger.subscribe(sub1, :level => :info)
|
69
69
|
@logger.subscribe(sub2, :level => :error)
|
70
|
+
@logger.trace("test trace")
|
70
71
|
@logger.debug("test debug")
|
71
72
|
@logger.info("test info")
|
72
73
|
@logger.error("test error")
|
@@ -75,6 +76,7 @@ describe Cabin::Channel do
|
|
75
76
|
assert_equal("test error", sub1.data[1][:message])
|
76
77
|
assert_equal("test error", sub2.data[0][:message])
|
77
78
|
end
|
79
|
+
|
78
80
|
test "context values" do
|
79
81
|
context = @logger.context
|
80
82
|
context["foo"] = "hello"
|
@@ -174,4 +176,5 @@ describe Cabin::Channel do
|
|
174
176
|
assert_equal("Hello world", event[:message])
|
175
177
|
assert_equal(:info, event[:level])
|
176
178
|
end
|
179
|
+
|
177
180
|
end # describe Cabin::Channel do
|
data/test/test_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cabin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jordan Sissel
|
8
|
-
autorequire:
|
9
8
|
bindir: bin
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 2025-09-23 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: rake
|
@@ -80,7 +79,6 @@ homepage: https://github.com/jordansissel/ruby-cabin
|
|
80
79
|
licenses:
|
81
80
|
- Apache License (2.0)
|
82
81
|
metadata: {}
|
83
|
-
post_install_message:
|
84
82
|
rdoc_options: []
|
85
83
|
require_paths:
|
86
84
|
- lib
|
@@ -96,10 +94,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
96
94
|
- !ruby/object:Gem::Version
|
97
95
|
version: '0'
|
98
96
|
requirements: []
|
99
|
-
|
100
|
-
rubygems_version: 2.4.8
|
101
|
-
signing_key:
|
97
|
+
rubygems_version: 3.6.2
|
102
98
|
specification_version: 4
|
103
99
|
summary: Experiments in structured and contextual logging
|
104
100
|
test_files: []
|
105
|
-
has_rdoc:
|