buffered_syslogger 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -1,11 +1,12 @@
1
1
  = BufferedSyslogger
2
2
 
3
3
  A drop-in replacement for the Rails 3 default BufferedLogger library,
4
- that logs to syslog instead of a log file. Builds on the `syslogger` gem.
4
+ that logs to syslog instead of a log file. Builds on the
5
+ {syslogger}[http://github.com/crohr/syslogger] gem.
5
6
 
6
7
  == Installation
7
8
 
8
- Put it into your Gemfile:
9
+ Put this into your Gemfile:
9
10
 
10
11
  gem 'buffered_syslogger'
11
12
 
@@ -24,7 +25,8 @@ Put it into your Gemfile:
24
25
 
25
26
  == Copyright
26
27
 
27
- Copyright (c) 2010 László Bács, Secret Sauce Partners, Inc.
28
+ Copyright (c) 2010 László Bácsi, Secret Sauce Partners, Inc.
29
+
28
30
  Copyright (c) 2010 Cyril, INRIA Rennes-Bretagne Atlantique.
29
31
 
30
32
  See LICENSE for details.
@@ -67,7 +67,7 @@ class BufferedSyslogger < ActiveSupport::BufferedLogger
67
67
  Syslog.open(@ident, @options, @facility) do |s|
68
68
  s.mask = Syslog::LOG_UPTO(MAPPING[@level])
69
69
  old_buffer.each do |severity, message|
70
- message.split(/[\r\f\n]/).each { |m| s.log(MAPPING[severity], m) }
70
+ message.split(/[\r\f\n]/).each { |m| s.log(MAPPING[severity], m.gsub('%', '%%')) }
71
71
  end
72
72
  end
73
73
  end
@@ -19,33 +19,31 @@ describe BufferedSyslogger do
19
19
  end
20
20
 
21
21
  %w{debug info warn error fatal unknown}.each do |logger_method|
22
- it "should respond to the #{logger_method.inspect} method" do
23
- BufferedSyslogger.new.should respond_to logger_method.to_sym
24
- end
22
+ it { should respond_to :"#{logger_method}" }
23
+ it { should respond_to :"#{logger_method}?" }
25
24
  end
26
25
 
27
- %w{debug info warn error fatal unknown}.each do |logger_method|
28
- it "should respond to the #{logger_method.inspect}? method" do
29
- BufferedSyslogger.new.should respond_to "#{logger_method}?".to_sym
30
- end
26
+ it "should escape % characters" do
27
+ Syslog.should_receive(:open).and_yield(syslog)
28
+ syslog.should_receive(:log).with(Syslog::LOG_INFO, "IE6 is at 5.6%% out of 31.1%% total IE share")
29
+ subject.info "IE6 is at 5.6% out of 31.1% total IE share"
31
30
  end
32
31
 
33
- describe "add" do
34
- before do
35
- @logger = BufferedSyslogger.new("my_app", Syslog::LOG_PID, Syslog::LOG_USER)
36
- end
37
- it "should respond to add" do
38
- @logger.should respond_to(:add)
39
- end
40
- it "should correctly log" do
41
- Syslog.should_receive(:open).with("my_app", Syslog::LOG_PID, Syslog::LOG_USER).and_yield(syslog)
32
+ describe '#add' do
33
+ subject { BufferedSyslogger.new("my_app", Syslog::LOG_PID, Syslog::LOG_USER) }
34
+
35
+ it { should respond_to(:add) }
36
+
37
+ it "should correctly log a simple message" do
38
+ Syslog.should_receive(:open).and_yield(syslog)
42
39
  syslog.should_receive(:log).with(Syslog::LOG_INFO, "message")
43
- @logger.add(Logger::INFO, "message")
40
+ subject.add(Logger::INFO, "message")
44
41
  end
42
+
45
43
  it "should take the message from the block if :message is nil" do
46
- Syslog.should_receive(:open).with("my_app", Syslog::LOG_PID, Syslog::LOG_USER).and_yield(syslog)
44
+ Syslog.should_receive(:open).and_yield(syslog)
47
45
  syslog.should_receive(:log).with(Syslog::LOG_INFO, "my message")
48
- @logger.add(Logger::INFO) { "my message" }
46
+ subject.add(Logger::INFO) { "my message" }
49
47
  end
50
48
  end
51
49
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: buffered_syslogger
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 0
10
- version: 0.1.0
9
+ - 1
10
+ version: 0.1.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - !binary |
@@ -18,7 +18,7 @@ autorequire:
18
18
  bindir: bin
19
19
  cert_chain: []
20
20
 
21
- date: 2010-10-11 00:00:00 +02:00
21
+ date: 2010-10-12 00:00:00 +02:00
22
22
  default_executable:
23
23
  dependencies:
24
24
  - !ruby/object:Gem::Dependency