syslogger 1.2.4 → 1.2.5
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +2 -0
- data/lib/syslogger.rb +5 -2
- data/spec/syslogger_spec.rb +24 -0
- metadata +14 -5
data/README.rdoc
CHANGED
data/lib/syslogger.rb
CHANGED
@@ -3,7 +3,7 @@ require 'logger'
|
|
3
3
|
|
4
4
|
class Syslogger
|
5
5
|
|
6
|
-
VERSION = "1.2.
|
6
|
+
VERSION = "1.2.5"
|
7
7
|
|
8
8
|
attr_reader :level, :ident, :options, :facility
|
9
9
|
|
@@ -47,7 +47,10 @@ class Syslogger
|
|
47
47
|
end
|
48
48
|
|
49
49
|
%w{debug info warn error fatal unknown}.each do |logger_method|
|
50
|
-
|
50
|
+
# Accepting *args as message could be nil.
|
51
|
+
# Default params not supported in ruby 1.8.7
|
52
|
+
define_method logger_method.to_sym do |*args, &block|
|
53
|
+
message = args.first || block && block.call
|
51
54
|
add(Logger.const_get(logger_method.upcase), message)
|
52
55
|
end
|
53
56
|
|
data/spec/syslogger_spec.rb
CHANGED
@@ -19,6 +19,30 @@ describe "Syslogger" do
|
|
19
19
|
it "should respond to the #{logger_method.inspect} method" do
|
20
20
|
Syslogger.new.should respond_to logger_method.to_sym
|
21
21
|
end
|
22
|
+
|
23
|
+
it "should log #{logger_method} without raising an exception if called with a block" do
|
24
|
+
logger = Syslogger.new
|
25
|
+
Syslog.stub!(:open).and_yield(syslog=mock("syslog", :mask= => true))
|
26
|
+
severity = Syslogger::MAPPING[Logger.const_get(logger_method.upcase)]
|
27
|
+
syslog.should_receive(:log).with(severity, "Some message that doesn't need to be in a block")
|
28
|
+
lambda {
|
29
|
+
logger.send(logger_method.to_sym) { "Some message that doesn't need to be in a block" }
|
30
|
+
}.should_not raise_error
|
31
|
+
end
|
32
|
+
|
33
|
+
it "should log #{logger_method} without raising an exception if called with a nil message" do
|
34
|
+
logger = Syslogger.new
|
35
|
+
lambda {
|
36
|
+
logger.send(logger_method.to_sym, nil)
|
37
|
+
}.should_not raise_error
|
38
|
+
end
|
39
|
+
|
40
|
+
it "should log #{logger_method} without raising an exception if called with a no message" do
|
41
|
+
logger = Syslogger.new
|
42
|
+
lambda {
|
43
|
+
logger.send(logger_method.to_sym)
|
44
|
+
}.should_not raise_error
|
45
|
+
end
|
22
46
|
end
|
23
47
|
|
24
48
|
it "should respond to <<" do
|
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: syslogger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
hash: 21
|
5
|
+
prerelease:
|
5
6
|
segments:
|
6
7
|
- 1
|
7
8
|
- 2
|
8
|
-
-
|
9
|
-
version: 1.2.
|
9
|
+
- 5
|
10
|
+
version: 1.2.5
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- Cyril Rohr
|
@@ -14,16 +15,18 @@ autorequire:
|
|
14
15
|
bindir: bin
|
15
16
|
cert_chain: []
|
16
17
|
|
17
|
-
date: 2011-
|
18
|
+
date: 2011-05-27 00:00:00 +02:00
|
18
19
|
default_executable:
|
19
20
|
dependencies:
|
20
21
|
- !ruby/object:Gem::Dependency
|
21
22
|
name: rake
|
22
23
|
prerelease: false
|
23
24
|
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
24
26
|
requirements:
|
25
27
|
- - ~>
|
26
28
|
- !ruby/object:Gem::Version
|
29
|
+
hash: 27
|
27
30
|
segments:
|
28
31
|
- 0
|
29
32
|
- 8
|
@@ -34,9 +37,11 @@ dependencies:
|
|
34
37
|
name: rspec
|
35
38
|
prerelease: false
|
36
39
|
requirement: &id002 !ruby/object:Gem::Requirement
|
40
|
+
none: false
|
37
41
|
requirements:
|
38
42
|
- - ~>
|
39
43
|
- !ruby/object:Gem::Version
|
44
|
+
hash: 9
|
40
45
|
segments:
|
41
46
|
- 1
|
42
47
|
- 3
|
@@ -69,17 +74,21 @@ rdoc_options:
|
|
69
74
|
require_paths:
|
70
75
|
- lib
|
71
76
|
required_ruby_version: !ruby/object:Gem::Requirement
|
77
|
+
none: false
|
72
78
|
requirements:
|
73
79
|
- - ">="
|
74
80
|
- !ruby/object:Gem::Version
|
81
|
+
hash: 31
|
75
82
|
segments:
|
76
83
|
- 1
|
77
84
|
- 8
|
78
85
|
version: "1.8"
|
79
86
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
87
|
+
none: false
|
80
88
|
requirements:
|
81
89
|
- - ">="
|
82
90
|
- !ruby/object:Gem::Version
|
91
|
+
hash: 9
|
83
92
|
segments:
|
84
93
|
- 1
|
85
94
|
- 3
|
@@ -87,7 +96,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
87
96
|
requirements: []
|
88
97
|
|
89
98
|
rubyforge_project:
|
90
|
-
rubygems_version: 1.
|
99
|
+
rubygems_version: 1.5.2
|
91
100
|
signing_key:
|
92
101
|
specification_version: 3
|
93
102
|
summary: Dead simple Ruby Syslog logger
|