alephant-logger 1.2.1 → 2.0.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
  SHA1:
3
- metadata.gz: 00d69303676014e2562900f0bbcd636f833cd0cb
4
- data.tar.gz: a64fd16e02eda2a9d01b3bef1e7e20d0c8aab0d2
3
+ metadata.gz: 821699a7a61714ac7e6ac5bc8bd3d1741c0480c7
4
+ data.tar.gz: 9e1ade2485022ca1fea86e848eb2ffb3cdd53848
5
5
  SHA512:
6
- metadata.gz: 2cb2fb196198b687d14c1d96934ed07f554e470398c26b80973fcfe98cfe3cea7ee3f41b55a22fc3a65e6f6f2b2e1b7f339677efdb8b5afc41ebe97a15347478
7
- data.tar.gz: b8fdb07fd3b5b0a01c020913212a4601a1ccc77b8dc58789f1be0f61e1f4244f2d00e301b8848880fa61db01e6f530f25c1eae3c336149d82c70bed7a248e994
6
+ metadata.gz: b78a21d484e90b0154597aed01724b3634acd040ca6274bdadfabbcfd4a44e9c6fa9f62aec0f2cb17efb27de9749a7b53716591945fe006c179382b23aad5557
7
+ data.tar.gz: 16f8885af837088504ec460ecb75fa7bca9dd4412a7849c77f2fa9a00bbe54a1b44d433354df5897d00969780771181f83630ba377f3c6c29b571ebab33e86e5
@@ -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"
@@ -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 << ::Logger.new(STDOUT)
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)
@@ -1,5 +1,5 @@
1
1
  module Alephant
2
2
  module Logger
3
- VERSION = "1.2.1"
3
+ VERSION = "2.0.0"
4
4
  end
5
5
  end
@@ -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 "msg"
19
+ expect_any_instance_of(Alephant::Logger::JSON).to receive(:info).with("event" => "Evented")
10
20
 
11
- subject.info "msg"
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 "foo"
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 "foo"
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: 1.2.1
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-02 00:00:00.000000000 Z
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: