scashin133-syslog_logger 1.7.1 → 1.7.2
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/VERSION +1 -1
- data/lib/syslog_logger.rb +5 -3
- data/scashin133-syslog_logger.gemspec +1 -1
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.7.
|
1
|
+
1.7.2
|
data/lib/syslog_logger.rb
CHANGED
@@ -59,7 +59,7 @@ class SyslogLogger
|
|
59
59
|
end
|
60
60
|
|
61
61
|
# Log level for Logger compatibility.
|
62
|
-
attr_accessor :level
|
62
|
+
attr_accessor :level, :filter
|
63
63
|
|
64
64
|
# Fills in variables for Logger compatibility. If this is the first
|
65
65
|
# instance of SyslogLogger, +program_name+ may be set to change the logged
|
@@ -67,7 +67,8 @@ class SyslogLogger
|
|
67
67
|
# with your syslog daemon.
|
68
68
|
#
|
69
69
|
# Due to the way syslog works, only one program name may be chosen.
|
70
|
-
def initialize(program_name = 'rails', facility = Syslog::LOG_USER)
|
70
|
+
def initialize(program_name = 'rails', facility = Syslog::LOG_USER, options={})
|
71
|
+
@filter = options[:filter]
|
71
72
|
@level = Logger::DEBUG
|
72
73
|
|
73
74
|
return if defined? SYSLOG
|
@@ -78,7 +79,8 @@ class SyslogLogger
|
|
78
79
|
def add(severity, message = nil, progname = nil, &block)
|
79
80
|
severity ||= Logger::UNKNOWN
|
80
81
|
if severity >= @level
|
81
|
-
prepend = progname ? "[#{progname}] " :
|
82
|
+
prepend = progname ? "[#{progname}] " : nil
|
83
|
+
prepend ||= @filter ? "[#{@filter}] " : ''
|
82
84
|
message = clean((prepend + (message || block.call)))
|
83
85
|
SYSLOG.send LEVEL_LOGGER_MAP[severity], clean(message)
|
84
86
|
end
|
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{scashin133-syslog_logger}
|
8
|
-
s.version = "1.7.
|
8
|
+
s.version = "1.7.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Eric Hodel", " Chris Powell", " Matthew Boeh", " Ian Lesperance", " Dana Danger", " Brian Smith", " Ashley Martens", "Sean Cashin"]
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: scashin133-syslog_logger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 15
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 7
|
9
|
-
-
|
10
|
-
version: 1.7.
|
9
|
+
- 2
|
10
|
+
version: 1.7.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Eric Hodel
|