SyslogLogger 1.4.0 → 1.4.1
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +4 -0
- data/.gemtest +0 -0
- data/History.txt +6 -0
- data/README.txt +46 -7
- data/Rakefile +8 -9
- data/lib/syslog_logger.rb +46 -6
- data/test/test_syslog_logger.rb +8 -8
- metadata +112 -43
- metadata.gz.sig +0 -0
data.tar.gz.sig
ADDED
data/.gemtest
ADDED
File without changes
|
data/History.txt
CHANGED
data/README.txt
CHANGED
@@ -1,17 +1,56 @@
|
|
1
1
|
= SyslogLogger
|
2
2
|
|
3
|
+
Documentation :: http://docs.seattlerb.org/SyslogLogger
|
4
|
+
Source :: https://github.com/seattlerb/sysloglogger
|
5
|
+
Bugtracker :: https://github.com/seattlerb/sysloglogger/issues
|
6
|
+
|
7
|
+
== DESCRIPTION
|
8
|
+
|
3
9
|
SyslogLogger is a Logger replacement that logs to syslog. It is almost
|
4
|
-
drop-in with a few
|
10
|
+
drop-in with a few differences.
|
11
|
+
|
12
|
+
== FEATURES
|
13
|
+
|
14
|
+
* Works like Logger
|
15
|
+
* Logs to syslog(3) mapping Logger levels to syslog(3) levels
|
16
|
+
|
17
|
+
== SYNOPSIS
|
18
|
+
|
19
|
+
require 'syslog_logger'
|
20
|
+
|
21
|
+
logger = SyslogLogger.new 'your_application_name'
|
22
|
+
|
23
|
+
logger.info 'did something cool'
|
24
|
+
|
25
|
+
== INSTALL
|
26
|
+
|
27
|
+
gem install SyslogLogger
|
28
|
+
|
29
|
+
You may need to configure your syslog.conf to place application logs in a
|
30
|
+
particular file. See SyslogLogger for details.
|
5
31
|
|
6
|
-
|
32
|
+
== LICENSE
|
7
33
|
|
8
|
-
|
34
|
+
(The MIT License)
|
9
35
|
|
10
|
-
|
36
|
+
Copyright (c) Eric Hodel
|
11
37
|
|
12
|
-
|
38
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
39
|
+
a copy of this software and associated documentation files (the
|
40
|
+
'Software'), to deal in the Software without restriction, including
|
41
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
42
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
43
|
+
permit persons to whom the Software is furnished to do so, subject to
|
44
|
+
the following conditions:
|
13
45
|
|
14
|
-
|
46
|
+
The above copyright notice and this permission notice shall be
|
47
|
+
included in all copies or substantial portions of the Software.
|
15
48
|
|
16
|
-
|
49
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
50
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
51
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
52
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
53
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
54
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
55
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
17
56
|
|
data/Rakefile
CHANGED
@@ -1,16 +1,15 @@
|
|
1
1
|
# -*- ruby -*-
|
2
2
|
|
3
3
|
require 'hoe'
|
4
|
-
require './lib/syslog_logger.rb'
|
5
4
|
|
6
|
-
Hoe.
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
5
|
+
Hoe.plugin :travis
|
6
|
+
Hoe.plugin :git
|
7
|
+
|
8
|
+
Hoe.spec 'SyslogLogger' do
|
9
|
+
developer 'Eric Hodel', 'drbrain@segment7.net'
|
10
|
+
|
11
|
+
rdoc_locations <<
|
12
|
+
'docs.seattlerb.org:/data/www/docs.seattlerb.org/SyslogLogger'
|
14
13
|
end
|
15
14
|
|
16
15
|
# vim: syntax=Ruby
|
data/lib/syslog_logger.rb
CHANGED
@@ -61,9 +61,9 @@ require 'logger'
|
|
61
61
|
#
|
62
62
|
# === syslog-ng.conf
|
63
63
|
#
|
64
|
-
#
|
65
|
-
#
|
66
|
-
#
|
64
|
+
# destination rails_log { file("/var/log/production.log"); };
|
65
|
+
# filter f_rails { program("rails.*"); };
|
66
|
+
# log { source(src); filter(f_rails); destination(rails_log); };
|
67
67
|
#
|
68
68
|
# == Starting
|
69
69
|
#
|
@@ -77,10 +77,15 @@ class SyslogLogger
|
|
77
77
|
##
|
78
78
|
# The version of SyslogLogger you are using.
|
79
79
|
|
80
|
-
VERSION = '1.4.
|
80
|
+
VERSION = '1.4.1'
|
81
81
|
|
82
82
|
##
|
83
83
|
# Maps Logger warning types to syslog(3) warning types.
|
84
|
+
#
|
85
|
+
# Messages from ruby applications are not considered as critical as messages
|
86
|
+
# from other processes using syslog(3), so most messages are reduced by one
|
87
|
+
# level. For example, a fatal message for ruby's Logger is considered an
|
88
|
+
# error for syslog(3).
|
84
89
|
|
85
90
|
LOGGER_MAP = {
|
86
91
|
:unknown => :alert,
|
@@ -126,6 +131,42 @@ class SyslogLogger
|
|
126
131
|
EOM
|
127
132
|
end
|
128
133
|
|
134
|
+
##
|
135
|
+
# :method: unknown
|
136
|
+
#
|
137
|
+
# Logs a +message+ at the unknown (syslog alert) log level, or logs the
|
138
|
+
# message returned from the block.
|
139
|
+
|
140
|
+
##
|
141
|
+
# :method: fatal
|
142
|
+
#
|
143
|
+
# Logs a +message+ at the fatal (syslog err) log level, or logs the message
|
144
|
+
# returned from the block.
|
145
|
+
|
146
|
+
##
|
147
|
+
# :method: error
|
148
|
+
#
|
149
|
+
# Logs a +message+ at the error (syslog warning) log level, or logs the
|
150
|
+
# message returned from the block.
|
151
|
+
|
152
|
+
##
|
153
|
+
# :method: warn
|
154
|
+
#
|
155
|
+
# Logs a +message+ at the warn (syslog notice) log level, or logs the
|
156
|
+
# message returned from the block.
|
157
|
+
|
158
|
+
##
|
159
|
+
# :method: info
|
160
|
+
#
|
161
|
+
# Logs a +message+ at the info (syslog info) log level, or logs the message
|
162
|
+
# returned from the block.
|
163
|
+
|
164
|
+
##
|
165
|
+
# :method: debug
|
166
|
+
#
|
167
|
+
# Logs a +message+ at the debug (syslog debug) log level, or logs the
|
168
|
+
# message returned from the block.
|
169
|
+
|
129
170
|
LOGGER_MAP.each_key do |level|
|
130
171
|
make_methods level
|
131
172
|
end
|
@@ -155,8 +196,7 @@ class SyslogLogger
|
|
155
196
|
def add(severity, message = nil, progname = nil, &block)
|
156
197
|
severity ||= Logger::UNKNOWN
|
157
198
|
return true if severity < @level
|
158
|
-
|
159
|
-
SYSLOG.send LEVEL_LOGGER_MAP[severity], clean(message)
|
199
|
+
SYSLOG.send LEVEL_LOGGER_MAP[severity], clean(message || block.call)
|
160
200
|
return true
|
161
201
|
end
|
162
202
|
|
data/test/test_syslog_logger.rb
CHANGED
@@ -258,14 +258,6 @@ class TestLogger < Test::Unit::TestCase
|
|
258
258
|
assert_equal LEVEL_LABEL_MAP[Logger::UNKNOWN], msg.severity
|
259
259
|
end
|
260
260
|
|
261
|
-
def test_unknown_eh
|
262
|
-
@logger.level = Logger::UNKNOWN
|
263
|
-
assert_equal true, @logger.unknown?
|
264
|
-
|
265
|
-
@logger.level = Logger::UNKNOWN + 1
|
266
|
-
assert_equal false, @logger.unknown?
|
267
|
-
end
|
268
|
-
|
269
261
|
def test_fatal
|
270
262
|
msg = log :fatal, 'fatal level message'
|
271
263
|
assert_equal LEVEL_LABEL_MAP[Logger::FATAL], msg.severity
|
@@ -487,5 +479,13 @@ class TestSyslogLogger < TestLogger
|
|
487
479
|
return msg
|
488
480
|
end
|
489
481
|
|
482
|
+
def test_unknown_eh
|
483
|
+
@logger.level = Logger::UNKNOWN
|
484
|
+
assert_equal true, @logger.unknown?
|
485
|
+
|
486
|
+
@logger.level = Logger::UNKNOWN + 1
|
487
|
+
assert_equal false, @logger.unknown?
|
488
|
+
end
|
489
|
+
|
490
490
|
end
|
491
491
|
|
metadata
CHANGED
@@ -1,33 +1,87 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
|
-
rubygems_version: 0.9.2
|
3
|
-
specification_version: 1
|
4
2
|
name: SyslogLogger
|
5
3
|
version: !ruby/object:Gem::Version
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
-
|
11
|
-
|
12
|
-
|
13
|
-
rubyforge_project: seattlerb
|
14
|
-
description: SyslogLogger is a Logger replacement that logs to syslog. It is almost drop-in with a few caveats.
|
15
|
-
autorequire:
|
16
|
-
default_executable:
|
17
|
-
bindir: bin
|
18
|
-
has_rdoc: true
|
19
|
-
required_ruby_version: !ruby/object:Gem::Version::Requirement
|
20
|
-
requirements:
|
21
|
-
- - ">"
|
22
|
-
- !ruby/object:Gem::Version
|
23
|
-
version: 0.0.0
|
24
|
-
version:
|
4
|
+
hash: 5
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 1
|
8
|
+
- 4
|
9
|
+
- 1
|
10
|
+
version: 1.4.1
|
25
11
|
platform: ruby
|
26
|
-
signing_key:
|
27
|
-
cert_chain:
|
28
|
-
post_install_message:
|
29
12
|
authors:
|
30
13
|
- Eric Hodel
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain:
|
17
|
+
- |
|
18
|
+
-----BEGIN CERTIFICATE-----
|
19
|
+
MIIDeDCCAmCgAwIBAgIBATANBgkqhkiG9w0BAQUFADBBMRAwDgYDVQQDDAdkcmJy
|
20
|
+
YWluMRgwFgYKCZImiZPyLGQBGRYIc2VnbWVudDcxEzARBgoJkiaJk/IsZAEZFgNu
|
21
|
+
ZXQwHhcNMTIwMjI4MTc1NDI1WhcNMTMwMjI3MTc1NDI1WjBBMRAwDgYDVQQDDAdk
|
22
|
+
cmJyYWluMRgwFgYKCZImiZPyLGQBGRYIc2VnbWVudDcxEzARBgoJkiaJk/IsZAEZ
|
23
|
+
FgNuZXQwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCbbgLrGLGIDE76
|
24
|
+
LV/cvxdEzCuYuS3oG9P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object:Gem::Dependency
|
43
|
+
name: rdoc
|
44
|
+
prerelease: false
|
45
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
46
|
+
none: false
|
47
|
+
requirements:
|
48
|
+
- - ~>
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
hash: 19
|
51
|
+
segments:
|
52
|
+
- 3
|
53
|
+
- 10
|
54
|
+
version: "3.10"
|
55
|
+
type: :development
|
56
|
+
version_requirements: *id001
|
57
|
+
- !ruby/object:Gem::Dependency
|
58
|
+
name: hoe
|
59
|
+
prerelease: false
|
60
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
61
|
+
none: false
|
62
|
+
requirements:
|
63
|
+
- - ~>
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
hash: 35
|
66
|
+
segments:
|
67
|
+
- 2
|
68
|
+
- 16
|
69
|
+
version: "2.16"
|
70
|
+
type: :development
|
71
|
+
version_requirements: *id002
|
72
|
+
description: |-
|
73
|
+
SyslogLogger is a Logger replacement that logs to syslog. It is almost
|
74
|
+
drop-in with a few differences.
|
75
|
+
email:
|
76
|
+
- drbrain@segment7.net
|
77
|
+
executables: []
|
78
|
+
|
79
|
+
extensions: []
|
80
|
+
|
81
|
+
extra_rdoc_files:
|
82
|
+
- History.txt
|
83
|
+
- Manifest.txt
|
84
|
+
- README.txt
|
31
85
|
files:
|
32
86
|
- History.txt
|
33
87
|
- Manifest.txt
|
@@ -36,25 +90,40 @@ files:
|
|
36
90
|
- lib/analyzer_tools/syslog_logger.rb
|
37
91
|
- lib/syslog_logger.rb
|
38
92
|
- test/test_syslog_logger.rb
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
extra_rdoc_files: []
|
44
|
-
|
45
|
-
executables: []
|
46
|
-
|
47
|
-
extensions: []
|
93
|
+
- .gemtest
|
94
|
+
homepage: http://docs.seattlerb.org/SyslogLogger
|
95
|
+
licenses: []
|
48
96
|
|
97
|
+
post_install_message:
|
98
|
+
rdoc_options:
|
99
|
+
- --main
|
100
|
+
- README.txt
|
101
|
+
require_paths:
|
102
|
+
- lib
|
103
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
104
|
+
none: false
|
105
|
+
requirements:
|
106
|
+
- - ">="
|
107
|
+
- !ruby/object:Gem::Version
|
108
|
+
hash: 3
|
109
|
+
segments:
|
110
|
+
- 0
|
111
|
+
version: "0"
|
112
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
113
|
+
none: false
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
hash: 3
|
118
|
+
segments:
|
119
|
+
- 0
|
120
|
+
version: "0"
|
49
121
|
requirements: []
|
50
122
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
- !ruby/object:Gem::Version
|
59
|
-
version: 1.2.0
|
60
|
-
version:
|
123
|
+
rubyforge_project: sysloglogger
|
124
|
+
rubygems_version: 1.8.21
|
125
|
+
signing_key:
|
126
|
+
specification_version: 3
|
127
|
+
summary: SyslogLogger is a Logger replacement that logs to syslog
|
128
|
+
test_files:
|
129
|
+
- test/test_syslog_logger.rb
|
metadata.gz.sig
ADDED
Binary file
|