logglier 0.2.1 → 0.2.3
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.
- data/lib/logglier/client/http.rb +1 -1
 - data/lib/logglier/version.rb +1 -1
 - data/spec/logglier_spec.rb +27 -0
 - metadata +3 -3
 
    
        data/lib/logglier/client/http.rb
    CHANGED
    
    | 
         @@ -12,7 +12,7 @@ module Logglier 
     | 
|
| 
       12 
12 
     | 
    
         | 
| 
       13 
13 
     | 
    
         
             
                  def initialize(opts={})
         
     | 
| 
       14 
14 
     | 
    
         
             
                    setup_input_uri(opts)
         
     | 
| 
       15 
     | 
    
         
            -
                    @format = opts[:format] ? opts[: 
     | 
| 
      
 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
         
     | 
    
        data/lib/logglier/version.rb
    CHANGED
    
    
    
        data/spec/logglier_spec.rb
    CHANGED
    
    | 
         @@ -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:  
     | 
| 
      
 4 
     | 
    
         
            +
              hash: 17
         
     | 
| 
       5 
5 
     | 
    
         
             
              prerelease: 
         
     | 
| 
       6 
6 
     | 
    
         
             
              segments: 
         
     | 
| 
       7 
7 
     | 
    
         
             
              - 0
         
     | 
| 
       8 
8 
     | 
    
         
             
              - 2
         
     | 
| 
       9 
     | 
    
         
            -
              -  
     | 
| 
       10 
     | 
    
         
            -
              version: 0.2. 
     | 
| 
      
 9 
     | 
    
         
            +
              - 3
         
     | 
| 
      
 10 
     | 
    
         
            +
              version: 0.2.3
         
     | 
| 
       11 
11 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       12 
12 
     | 
    
         
             
            authors: 
         
     | 
| 
       13 
13 
     | 
    
         
             
            - Edward Muller (aka freeformz)
         
     |