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