alephant-logger 1.2.1 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/alephant-logger.gemspec +2 -0
- data/lib/alephant/logger/base.rb +7 -1
- data/lib/alephant/logger/version.rb +1 -1
- data/spec/logger_base_spec.rb +15 -5
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 821699a7a61714ac7e6ac5bc8bd3d1741c0480c7
|
4
|
+
data.tar.gz: 9e1ade2485022ca1fea86e848eb2ffb3cdd53848
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b78a21d484e90b0154597aed01724b3634acd040ca6274bdadfabbcfd4a44e9c6fa9f62aec0f2cb17efb27de9749a7b53716591945fe006c179382b23aad5557
|
7
|
+
data.tar.gz: 16f8885af837088504ec460ecb75fa7bca9dd4412a7849c77f2fa9a00bbe54a1b44d433354df5897d00969780771181f83630ba377f3c6c29b571ebab33e86e5
|
data/alephant-logger.gemspec
CHANGED
@@ -17,6 +17,8 @@ Gem::Specification.new do |spec|
|
|
17
17
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
18
18
|
spec.require_paths = ["lib"]
|
19
19
|
|
20
|
+
spec.add_runtime_dependency "alephant-logger-json", "0.1"
|
21
|
+
|
20
22
|
spec.add_development_dependency "rspec"
|
21
23
|
spec.add_development_dependency "rspec-nc"
|
22
24
|
spec.add_development_dependency "guard"
|
data/lib/alephant/logger/base.rb
CHANGED
@@ -1,8 +1,14 @@
|
|
1
|
+
require "alephant/logger/json"
|
2
|
+
|
1
3
|
module Alephant
|
2
4
|
module Logger
|
3
5
|
class Base
|
4
6
|
def initialize(drivers)
|
5
|
-
@drivers = drivers
|
7
|
+
@drivers = drivers
|
8
|
+
|
9
|
+
unless drivers.any? { |driver| driver.is_a? Alephant::Logger::JSON }
|
10
|
+
drivers << Alephant::Logger::JSON.new("app.log")
|
11
|
+
end
|
6
12
|
end
|
7
13
|
|
8
14
|
def write(*args)
|
data/spec/logger_base_spec.rb
CHANGED
@@ -1,14 +1,24 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
|
+
require "pry"
|
3
4
|
describe Alephant::Logger::Base do
|
5
|
+
context "no Alephant::Logger::JSON driver given" do
|
6
|
+
it "defaults to include Alephant::Logger::JSON" do
|
7
|
+
allow(Alephant::Logger::JSON).to receive(:new) { @called = true }
|
8
|
+
|
9
|
+
described_class.new []
|
10
|
+
expect(@called).to be_truthy
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
4
14
|
describe "#info" do
|
5
15
|
context "no logger drivers given" do
|
6
16
|
subject { Alephant::Logger::Base.new [] }
|
7
17
|
|
8
18
|
specify do
|
9
|
-
expect_any_instance_of(::Logger).to receive(:info).with "
|
19
|
+
expect_any_instance_of(Alephant::Logger::JSON).to receive(:info).with("event" => "Evented")
|
10
20
|
|
11
|
-
subject.info "
|
21
|
+
subject.info("event" => "Evented")
|
12
22
|
end
|
13
23
|
end
|
14
24
|
|
@@ -23,10 +33,10 @@ describe Alephant::Logger::Base do
|
|
23
33
|
subject.metric("foo")
|
24
34
|
end
|
25
35
|
|
26
|
-
it "::Logger is always used" do
|
27
|
-
expect_any_instance_of(::Logger).to receive(:info).with "
|
36
|
+
it "Alephant::Logger::JSON is always used" do
|
37
|
+
expect_any_instance_of(Alephant::Logger::JSON).to receive(:info).with("event" => "Evented")
|
28
38
|
|
29
|
-
subject.info "
|
39
|
+
subject.info("event" => "Evented")
|
30
40
|
end
|
31
41
|
end
|
32
42
|
end
|
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: alephant-logger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- BBC News
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-06-
|
11
|
+
date: 2015-06-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
15
|
+
requirements:
|
16
|
+
- - '='
|
17
|
+
- !ruby/object:Gem::Version
|
18
|
+
version: '0.1'
|
19
|
+
name: alephant-logger-json
|
20
|
+
prerelease: false
|
21
|
+
type: :runtime
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0.1'
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
requirement: !ruby/object:Gem::Requirement
|
15
29
|
requirements:
|