logglier 0.2.1 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -12,7 +12,7 @@ module Logglier
12
12
 
13
13
  def initialize(opts={})
14
14
  setup_input_uri(opts)
15
- @format = opts[:format] ? opts[:formt].to_sym : nil
15
+ @format = opts[:format] ? opts[:format].to_sym : nil
16
16
  @deliverer = if opts[:threaded]
17
17
  Logglier::Client::HTTP::DeliveryThread.new(@input_uri, opts)
18
18
  else
@@ -1,3 +1,3 @@
1
1
  module Logglier
2
- VERSION = '0.2.1'
2
+ VERSION = '0.2.3'
3
3
  end
@@ -25,6 +25,33 @@ describe Logglier do
25
25
  it_should_behave_like "a logglier enhanced Logger instance"
26
26
  end
27
27
 
28
+ context "formatting" do
29
+ subject { new_logglier('https://localhost', :format => :json) }
30
+
31
+ it { should be_an_instance_of Logger }
32
+
33
+ context "with a string" do
34
+ it "should send a message via the logdev" do
35
+ subject.logdev.dev.should_receive(:write).with(/severity=WARN, foo/)
36
+ subject.add(Logger::WARN) { 'foo' }
37
+ end
38
+ end
39
+
40
+ context "with a hash" do
41
+ it "should send a message via the logdev" do
42
+ subject.logdev.dev.should_receive(:write).with(/"severity":"WARN"/)
43
+ subject.logdev.dev.should_receive(:write).with(/"foo":"bar"/)
44
+ subject.logdev.dev.should_receive(:write).with(/"man":"pants"/)
45
+ # The following is equiv to:
46
+ # subject.warn :foo => :bar, :man => :pants
47
+ subject.add(Logger::WARN) { {:foo => :bar, :man => :pants} }
48
+ subject.add(Logger::WARN) { {:foo => :bar, :man => :pants} }
49
+ subject.add(Logger::WARN) { {:foo => :bar, :man => :pants} }
50
+ end
51
+ end
52
+
53
+ end
54
+
28
55
  end
29
56
 
30
57
  context "Syslog TCP" do
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logglier
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
4
+ hash: 17
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 1
10
- version: 0.2.1
9
+ - 3
10
+ version: 0.2.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Edward Muller (aka freeformz)