remote_syslog_logger 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
data/lib/remote_syslog_logger.rb
CHANGED
@@ -3,7 +3,7 @@ require 'remote_syslog_logger/udp_sender'
|
|
3
3
|
require 'logger'
|
4
4
|
|
5
5
|
module RemoteSyslogLogger
|
6
|
-
VERSION = '1.0.
|
6
|
+
VERSION = '1.0.3'
|
7
7
|
|
8
8
|
def self.new(remote_hostname, remote_port, options = {})
|
9
9
|
Logger.new(RemoteSyslogLogger::UdpSender.new(remote_hostname, remote_port, options))
|
@@ -6,6 +6,7 @@ module RemoteSyslogLogger
|
|
6
6
|
def initialize(remote_hostname, remote_port, options = {})
|
7
7
|
@remote_hostname = remote_hostname
|
8
8
|
@remote_port = remote_port
|
9
|
+
@whinyerrors = options[:whinyerrors]
|
9
10
|
|
10
11
|
@socket = UDPSocket.new
|
11
12
|
@packet = SyslogProtocol::Packet.new
|
@@ -21,10 +22,15 @@ module RemoteSyslogLogger
|
|
21
22
|
|
22
23
|
def transmit(message)
|
23
24
|
message.split(/\r?\n/).each do |line|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
25
|
+
begin
|
26
|
+
next if line =~ /^\s*$/
|
27
|
+
packet = @packet.dup
|
28
|
+
packet.content = line
|
29
|
+
@socket.send(packet.assemble, 0, @remote_hostname, @remote_port)
|
30
|
+
rescue
|
31
|
+
$stderr.puts "#{self.class} error: #{$!.class}: #{$!}\nOriginal message: #{line}"
|
32
|
+
raise if @whinyerrors
|
33
|
+
end
|
28
34
|
end
|
29
35
|
end
|
30
36
|
|
@@ -35,4 +41,4 @@ module RemoteSyslogLogger
|
|
35
41
|
@socket.close
|
36
42
|
end
|
37
43
|
end
|
38
|
-
end
|
44
|
+
end
|
@@ -13,8 +13,8 @@ Gem::Specification.new do |s|
|
|
13
13
|
## If your rubyforge_project name is different, then edit it and comment out
|
14
14
|
## the sub! line in the Rakefile
|
15
15
|
s.name = 'remote_syslog_logger'
|
16
|
-
s.version = '1.0.
|
17
|
-
s.date = '2011-
|
16
|
+
s.version = '1.0.3'
|
17
|
+
s.date = '2011-06-06'
|
18
18
|
# s.rubyforge_project = 'remote_syslog_logger'
|
19
19
|
|
20
20
|
## Make sure your summary is short. The description may be as long
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: remote_syslog_logger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 17
|
5
|
+
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 1.0.
|
9
|
+
- 3
|
10
|
+
version: 1.0.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Eric Lindvall
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-06-06 00:00:00 -07:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -81,7 +81,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
81
81
|
requirements: []
|
82
82
|
|
83
83
|
rubyforge_project:
|
84
|
-
rubygems_version: 1.
|
84
|
+
rubygems_version: 1.4.2
|
85
85
|
signing_key:
|
86
86
|
specification_version: 2
|
87
87
|
summary: Ruby Logger that sends directly to a remote syslog endpoint
|