remote_syslog_logger 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,7 +3,7 @@ require 'remote_syslog_logger/udp_sender'
3
3
  require 'logger'
4
4
 
5
5
  module RemoteSyslogLogger
6
- VERSION = '1.0.0'
6
+ VERSION = '1.0.1'
7
7
 
8
8
  def self.new(remote_hostname, remote_port, options = {})
9
9
  Logger.new(RemoteSyslogLogger::UdpSender.new(remote_hostname, remote_port, options))
@@ -20,9 +20,12 @@ module RemoteSyslogLogger
20
20
  end
21
21
 
22
22
  def transmit(message)
23
- packet = @packet.dup
24
- packet.content = message
25
- @socket.send(packet.assemble, 0, @remote_hostname, @remote_port)
23
+ message.split("\n").each do |line|
24
+ next if line =~ /^\s*$/
25
+ packet = @packet.dup
26
+ packet.content = line
27
+ @socket.send(packet.assemble, 0, @remote_hostname, @remote_port)
28
+ end
26
29
  end
27
30
 
28
31
  # Make this act a little bit like an `IO` object
@@ -13,7 +13,7 @@ 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.0'
16
+ s.version = '1.0.1'
17
17
  s.date = '2011-03-28'
18
18
  # s.rubyforge_project = 'remote_syslog_logger'
19
19
 
@@ -12,7 +12,17 @@ class TestRemoteSyslogLogger < Test::Unit::TestCase
12
12
  @logger.info "This is a test"
13
13
 
14
14
  message, addr = *@socket.recvfrom(1024)
15
- puts message
16
15
  assert_match /This is a test/, message
17
16
  end
17
+
18
+ def test_logger_multiline
19
+ @logger = RemoteSyslogLogger.new('127.0.0.1', @server_port)
20
+ @logger.info "This is a test\nThis is the second line"
21
+
22
+ message, addr = *@socket.recvfrom(1024)
23
+ assert_match /This is a test/, message
24
+
25
+ message, addr = *@socket.recvfrom(1024)
26
+ assert_match /This is the second line/, message
27
+ end
18
28
  end
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: 23
4
+ hash: 21
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - 0
10
- version: 1.0.0
9
+ - 1
10
+ version: 1.0.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Eric Lindvall