logglier 0.2.8 → 0.2.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ Yzc0NmNmOWNjZTQwMjA0YzQ2ZmFmMjAwMWJlNThhN2RmOWE2NjA0NQ==
5
+ data.tar.gz: !binary |-
6
+ YTVkMDI0ZTRiYjc1YTYzMjYwY2ZhMzUyZTZmZDBlNDU0ODc3MTc4OQ==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ NjAzMTNhMTQ0Y2YwNjZlZjU0NzNjYjk0MjM1ODBhZjMwZjE5ZjdmYTRjYmM0
10
+ YjFmZmNmZjE5MDRiNTNlZWZiNGU3MGJlZDYyNjA0NTgxMTZiNGUwMTg3YTA4
11
+ NWQzYjY4YzNkYTQ5YzY2ODE1ODhhYmZjY2IxMzM0YjY5ODVhNWI=
12
+ data.tar.gz: !binary |-
13
+ NWNhOWM3MjU1ZjE0MjNiNWIxOTEwYThiODQ5ZDNlODgyZTNkMjNjZjM4NDY4
14
+ ZWUwMGIyYTU3OWY3ZWU2MTE2NzRlMTNjNWRiOTUwY2E1YjgwYjQ4ZDUwM2Zk
15
+ MGFkOWY4MzZhZWUxMmVlNzY2M2Y4Y2ViOTg1Y2M3NmUzMTlhNTE=
data/Gemfile CHANGED
@@ -1,16 +1,7 @@
1
- source 'http://rubygems.org'
1
+ source :rubygems
2
2
 
3
3
  gemspec
4
4
 
5
5
  platforms :jruby do
6
6
  gem 'jruby-openssl'
7
- gem 'json'
8
- end
9
-
10
- platforms :mri_18 do
11
- gem 'json'
12
- end
13
-
14
- platforms :rbx do
15
- gem 'json'
16
7
  end
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  Overview
2
2
  --------
3
- [![Build Status](http://travis-ci.org/freeformz/logglier.png)](http://travis-ci.org/freeformz/logglier)
3
+ [![Build Status](https://travis-ci.org/freeformz/logglier.png)](https://travis-ci.org/freeformz/logglier)
4
4
 
5
5
  Send logged messages to Loggly using either the HTTP API or Syslog/UDP.
6
6
 
@@ -67,6 +67,9 @@ Example:
67
67
  Logglier.new('https://logs.loggly.com/inputs/<id>',
68
68
  :format => :json)
69
69
 
70
+ Logglier uses [MultiJson](https://github.com/intridea/multi_json) to delegate the choice of JSON libraries to you, but I recommend using
71
+ [Yajl](https://github.com/brianmario/yajl-ruby), just require the json gem of your choice before logglier.
72
+
70
73
  ### Syslog TCP/UDP Inputs
71
74
 
72
75
  Logglier.new('[udp|tcp]://<hostname>:<port>/<facility>')
@@ -110,6 +113,7 @@ Pull requests welcome
110
113
  TODO
111
114
  -----
112
115
 
116
+ * Support ActiveSupport Notifications for newer rails
113
117
  * Alternative https implementations (Typheous, Excon, etc). May be
114
118
  faster?
115
119
  * EM Integration?
@@ -32,6 +32,10 @@ module Logglier
32
32
  @open_timeout = opts[:open_timeout] || 5
33
33
  @failsafe = opts[:failsafe] || $stderr
34
34
  @format = opts[:format] ? opts[:format].to_sym : nil
35
+ @proxy_addr = opts[:proxy_addr]
36
+ @proxy_port = opts[:proxy_port]
37
+ @proxy_user = opts[:proxy_user]
38
+ @proxy_password = opts[:proxy_password]
35
39
  @headers = {}
36
40
  if @format == :json
37
41
  @headers['Content-Type'] = 'application/json'
@@ -68,7 +72,8 @@ module Logglier
68
72
  private
69
73
 
70
74
  def connect!
71
- @http = Net::HTTP.new(@input_uri.host, @input_uri.port)
75
+ @http_class = Net::HTTP::Proxy(@proxy_addr, @proxy_port, @proxy_user, @proxy_user)
76
+ @http = @http_class.new(@input_uri.host, @input_uri.port)
72
77
 
73
78
  if @input_uri.scheme == 'https'
74
79
  @http.use_ssl = true
@@ -86,7 +91,7 @@ module Logglier
86
91
  end
87
92
 
88
93
  def failsafe_retrying(exception, message, retries)
89
- @failsafe.puts "WARNING: [#{retries}/#{RETRIES}] " + failsafe_message(exception, message)
94
+ @failsafe.puts "RETRY: [#{retries} of #{RETRIES}] " + failsafe_message(exception, message)
90
95
  end
91
96
 
92
97
  def failsafe_errored(exception, message)
@@ -1,4 +1,4 @@
1
- require 'json'
1
+ require 'multi_json'
2
2
 
3
3
  module Logglier
4
4
  module Client
@@ -60,9 +60,9 @@ module Logglier
60
60
  def formatter
61
61
  proc do |severity, datetime, progname, msg|
62
62
  if @format == :json && msg.is_a?(Hash)
63
- msg.merge!({ :severity => severity,
64
- :datetime => datetime,
65
- :progname => progname }).to_json
63
+ MultiJson.dump(msg.merge({ :severity => severity,
64
+ :datetime => datetime,
65
+ :progname => progname }))
66
66
  else
67
67
  message = "#{datetime} "
68
68
  message << massage_message(msg, severity)
@@ -1,3 +1,3 @@
1
1
  module Logglier
2
- VERSION = '0.2.8'
2
+ VERSION = '0.2.9'
3
3
  end
data/logglier.gemspec CHANGED
@@ -12,9 +12,9 @@ Gem::Specification.new do |s|
12
12
  s.email = 'edwardam@interlix.com'
13
13
  s.homepage = 'http://github.com/freeformz/logglier'
14
14
 
15
- s.files = %w{ README.md Gemfile LICENSE logglier.gemspec Rakefile } + Dir["#{dir}/lib/**/*.rb"]
15
+ s.files = %w{ README.md Gemfile LICENSE logglier.gemspec Rakefile } + Dir["lib/**/*.rb"]
16
16
  s.require_paths = ['lib']
17
- s.test_files = Dir["#{dir}/spec/**/*.rb"]
17
+ s.test_files = Dir["spec/**/*.rb"]
18
18
 
19
19
  s.rubyforge_project = 'logglier'
20
20
 
@@ -23,6 +23,7 @@ Gem::Specification.new do |s|
23
23
 
24
24
  s.add_development_dependency 'rake'
25
25
  s.add_development_dependency 'rspec', '~> 2.11.0'
26
+ s.add_development_dependency 'multi_json'
26
27
  end
27
28
 
28
29
 
data/spec/client_spec.rb CHANGED
@@ -28,9 +28,8 @@ describe Logglier::Client do
28
28
  end
29
29
 
30
30
  context "that is a valid udp uri" do
31
-
32
31
  it "should return an instance of the proper client" do
33
- log = Logglier::Client.new('udp://logs.loggly.com:42538')
32
+ log = Logglier::Client.new('udp://localhost:42538')
34
33
  log.should be_an_instance_of Logglier::Client::Syslog
35
34
  end
36
35
  end
data/spec/http_spec.rb CHANGED
@@ -46,7 +46,7 @@ describe 'HTTP' do
46
46
  @failsafe.rewind
47
47
  lines = @failsafe.readlines
48
48
  lines.size.should == 4
49
- lines[0..2].each {|l| l.should =~ /^WARNING/ }
49
+ lines[0..2].each {|l| l.should =~ /^RETRY/ }
50
50
  lines.last.should =~ /^ERROR/
51
51
  end
52
52
  end
@@ -67,7 +67,7 @@ describe 'HTTP' do
67
67
  @failsafe.rewind
68
68
  lines = @failsafe.readlines
69
69
  lines.size.should == 3
70
- lines[0..2].each {|l| l.should =~ /^WARNING/ }
70
+ lines[0..2].each {|l| l.should =~ /^RETRY/ }
71
71
  end
72
72
  end
73
73
  end
@@ -6,7 +6,7 @@ describe Logglier::Client::HTTP::DeliveryThread do
6
6
  Logglier::Client::HTTP::NetHTTPProxy.stub(:new) { @mock_http }
7
7
  end
8
8
 
9
- subject { described_class.new(URI.parse('http://localhost')) }
9
+ subject { Logglier::Client::HTTP::DeliveryThread.new(URI.parse('http://localhost')) }
10
10
 
11
11
  it "should deliver the message" do
12
12
  @mock_http.should_receive(:deliver).with("test")
@@ -26,7 +26,7 @@ describe Logglier::Client::HTTP::DeliveryThreadManager do
26
26
  Logglier::Client::HTTP::NetHTTPProxy.stub(:new) { @mock_http }
27
27
  end
28
28
 
29
- subject { described_class.new(URI.parse('http://localhost')) }
29
+ subject { Logglier::Client::HTTP::DeliveryThreadManager.new(URI.parse('http://localhost')) }
30
30
 
31
31
  it "should instantiate a delivery_thread" do
32
32
  Logglier::Client::HTTP::DeliveryThread.should_receive(:new).once
@@ -50,6 +50,8 @@ describe Logglier::Client::HTTP::DeliveryThreadManager do
50
50
 
51
51
  @first_thread.kill
52
52
 
53
+ @first_thread.join
54
+
53
55
  subject.deliver('force respawn')
54
56
 
55
57
  @second_thread = subject.instance_variable_get(:@thread)
metadata CHANGED
@@ -1,20 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logglier
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.8
5
- prerelease:
4
+ version: 0.2.9
6
5
  platform: ruby
7
6
  authors:
8
7
  - Edward Muller (aka freeformz)
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2012-08-12 00:00:00.000000000 Z
11
+ date: 2013-09-11 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rake
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - ! '>='
20
18
  - !ruby/object:Gem::Version
@@ -22,7 +20,6 @@ dependencies:
22
20
  type: :development
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
24
  - - ! '>='
28
25
  - !ruby/object:Gem::Version
@@ -30,7 +27,6 @@ dependencies:
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: rspec
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
31
  - - ~>
36
32
  - !ruby/object:Gem::Version
@@ -38,11 +34,24 @@ dependencies:
38
34
  type: :development
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
38
  - - ~>
44
39
  - !ruby/object:Gem::Version
45
40
  version: 2.11.0
41
+ - !ruby/object:Gem::Dependency
42
+ name: multi_json
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ! '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
46
55
  description: Logger => Loggly
47
56
  email: edwardam@interlix.com
48
57
  executables: []
@@ -54,48 +63,46 @@ files:
54
63
  - LICENSE
55
64
  - logglier.gemspec
56
65
  - Rakefile
57
- - ./lib/logglier/client/http/sync.rb
58
- - ./lib/logglier/client/http/threaded.rb
59
- - ./lib/logglier/client/http.rb
60
- - ./lib/logglier/client/syslog.rb
61
- - ./lib/logglier/client.rb
62
- - ./lib/logglier/version.rb
63
- - ./lib/logglier.rb
64
- - ./spec/client/syslog_spec.rb
65
- - ./spec/client_spec.rb
66
- - ./spec/http_spec.rb
67
- - ./spec/logglier_spec.rb
68
- - ./spec/spec_helper.rb
69
- - ./spec/threaded_spec.rb
66
+ - lib/logglier/client/http/sync.rb
67
+ - lib/logglier/client/http/threaded.rb
68
+ - lib/logglier/client/http.rb
69
+ - lib/logglier/client/syslog.rb
70
+ - lib/logglier/client.rb
71
+ - lib/logglier/version.rb
72
+ - lib/logglier.rb
73
+ - spec/client/syslog_spec.rb
74
+ - spec/client_spec.rb
75
+ - spec/http_spec.rb
76
+ - spec/logglier_spec.rb
77
+ - spec/spec_helper.rb
78
+ - spec/threaded_spec.rb
70
79
  homepage: http://github.com/freeformz/logglier
71
80
  licenses: []
81
+ metadata: {}
72
82
  post_install_message:
73
83
  rdoc_options: []
74
84
  require_paths:
75
85
  - lib
76
86
  required_ruby_version: !ruby/object:Gem::Requirement
77
- none: false
78
87
  requirements:
79
88
  - - ! '>='
80
89
  - !ruby/object:Gem::Version
81
90
  version: 1.8.6
82
91
  required_rubygems_version: !ruby/object:Gem::Requirement
83
- none: false
84
92
  requirements:
85
93
  - - ! '>='
86
94
  - !ruby/object:Gem::Version
87
95
  version: 1.3.6
88
96
  requirements: []
89
97
  rubyforge_project: logglier
90
- rubygems_version: 1.8.23
98
+ rubygems_version: 2.1.2
91
99
  signing_key:
92
- specification_version: 3
100
+ specification_version: 4
93
101
  summary: Loggly "plugin" for Logger
94
102
  test_files:
95
- - ./spec/client/syslog_spec.rb
96
- - ./spec/client_spec.rb
97
- - ./spec/http_spec.rb
98
- - ./spec/logglier_spec.rb
99
- - ./spec/spec_helper.rb
100
- - ./spec/threaded_spec.rb
101
- has_rdoc:
103
+ - spec/client/syslog_spec.rb
104
+ - spec/client_spec.rb
105
+ - spec/http_spec.rb
106
+ - spec/logglier_spec.rb
107
+ - spec/spec_helper.rb
108
+ - spec/threaded_spec.rb