takihiro-simple_syslog_logger 0.0.6 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README +9 -6
- data/lib/simple_syslog_logger.rb +4 -2
- data/spec/simple_syslog_logger_spec.rb +6 -0
- metadata +4 -4
data/README
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
= simple_syslog_logger
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
== Description
|
3
|
+
simple_syslog_logger is simple logging utility that bridge rails
|
4
|
+
and ruby syslog library.
|
6
5
|
|
7
6
|
== Install
|
8
7
|
|
8
|
+
% [sudo] gem source -a http://gems.github.com # you only need to do once
|
9
9
|
% [sudo] gem install takihiro-simple_syslog_logger
|
10
10
|
|
11
11
|
== Usage
|
@@ -14,8 +14,11 @@ Add the following line to config/environment.rb:
|
|
14
14
|
|
15
15
|
config.gem 'takihiro-simple_syslog_logger', :lib => 'simple_syslog_logger'
|
16
16
|
|
17
|
-
and the following lines to config
|
17
|
+
and the following lines to your config file:
|
18
|
+
|
19
|
+
config.logger = SimpleSyslogLogger.new(ident, options, facility)
|
20
|
+
|
21
|
+
== Link
|
18
22
|
|
19
|
-
|
20
|
-
config.logger.level = Syslog::LOG_ERR
|
23
|
+
http://github.com/takihiro/simple_syslog_logger/
|
21
24
|
|
data/lib/simple_syslog_logger.rb
CHANGED
@@ -3,7 +3,7 @@ require 'active_support'
|
|
3
3
|
|
4
4
|
class SimpleSyslogLogger
|
5
5
|
|
6
|
-
VERSION = '0.0.
|
6
|
+
VERSION = '0.0.7'
|
7
7
|
|
8
8
|
DEFAULT_MAP = {
|
9
9
|
:fatal => Syslog::LOG_ALERT,
|
@@ -26,7 +26,9 @@ class SimpleSyslogLogger
|
|
26
26
|
|
27
27
|
def add(severity, message = nil, progname = nil, &block)
|
28
28
|
message = (message || (block && block.call) || progname).to_s
|
29
|
-
|
29
|
+
clean_message(message).split("\n").each do |line|
|
30
|
+
@syslog.log(severity, line)
|
31
|
+
end
|
30
32
|
end
|
31
33
|
|
32
34
|
def level=(level)
|
@@ -44,6 +44,12 @@ describe SimpleSyslogLogger do
|
|
44
44
|
@logger.add(level, 'a % b % c')
|
45
45
|
end
|
46
46
|
|
47
|
+
it 'should syslog called log method more than once when message include "\n"' do
|
48
|
+
@syslog_mock.should_receive(:log).exactly(7).times
|
49
|
+
@logger.add(Syslog::LOG_ERR, "1\n2")
|
50
|
+
@logger.add(Syslog::LOG_ERR, "1\n2\n3\n4\n5")
|
51
|
+
end
|
52
|
+
|
47
53
|
end
|
48
54
|
|
49
55
|
describe 'level' do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: takihiro-simple_syslog_logger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hiroaki Takisawa
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-03-10 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -22,7 +22,7 @@ dependencies:
|
|
22
22
|
- !ruby/object:Gem::Version
|
23
23
|
version: 2.0.0
|
24
24
|
version:
|
25
|
-
description:
|
25
|
+
description: simple_syslog_logger is simple logging utility that bridge rails logger and ruby syslog library.
|
26
26
|
email: takky818@gmail.com
|
27
27
|
executables: []
|
28
28
|
|
@@ -60,6 +60,6 @@ rubyforge_project:
|
|
60
60
|
rubygems_version: 1.2.0
|
61
61
|
signing_key:
|
62
62
|
specification_version: 2
|
63
|
-
summary:
|
63
|
+
summary: simple_syslog_logger is simple logging utility that bridge rails logger and ruby syslog library.
|
64
64
|
test_files: []
|
65
65
|
|