syslogger 1.6.3 → 1.6.4
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.
- checksums.yaml +4 -4
- data/lib/syslogger.rb +4 -4
- data/spec/syslogger_spec.rb +27 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c21391ce1c6dd9acb99edabd4dcd73a730ddb6c9
|
4
|
+
data.tar.gz: 94d556ab7bd1569c0eae7162a2541d9f27aeb6a1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6abc0fcc0946fd0950a492b9a09b071d0636b1ebaaca8a5b9e73bf5cdd05589b25bd202b46f6842f222390d20a3e8a59d5b7ae170b6100ef279a43db798c18fc
|
7
|
+
data.tar.gz: 716670a2a752274f51874823618bec6874bbf832c14b82a1f51ba13afe7e431948d183cfd3897afce404d97e0d4f5f360dc1a9439f4d02c1d5dba0bffe615658
|
data/lib/syslogger.rb
CHANGED
@@ -4,7 +4,7 @@ require 'thread'
|
|
4
4
|
|
5
5
|
class Syslogger
|
6
6
|
|
7
|
-
VERSION = "1.6.
|
7
|
+
VERSION = "1.6.4"
|
8
8
|
|
9
9
|
MUTEX = Mutex.new
|
10
10
|
|
@@ -92,8 +92,8 @@ class Syslogger
|
|
92
92
|
end
|
93
93
|
progname ||= @ident
|
94
94
|
mask = Syslog::LOG_UPTO(MAPPING[@level])
|
95
|
-
communication =
|
96
|
-
formatted_communication = formatter.call([severity], Time.now, progname, communication)
|
95
|
+
communication = message || block && block.call
|
96
|
+
formatted_communication = clean(formatter.call([severity], Time.now, progname, communication))
|
97
97
|
|
98
98
|
MUTEX.synchronize do
|
99
99
|
Syslog.open(progname, @options, @facility) do |s|
|
@@ -177,7 +177,7 @@ class Syslogger
|
|
177
177
|
def tags_text
|
178
178
|
tags = current_tags
|
179
179
|
if tags.any?
|
180
|
-
tags.collect { |tag| "[#{tag}] " }.join
|
180
|
+
clean(tags.collect { |tag| "[#{tag}] " }.join) << " "
|
181
181
|
end
|
182
182
|
end
|
183
183
|
|
data/spec/syslogger_spec.rb
CHANGED
@@ -182,6 +182,33 @@ describe "Syslogger" do
|
|
182
182
|
syslog.should_receive(:log).with(Syslog::LOG_INFO, "%%me%%ssage%%")
|
183
183
|
@logger.add(Logger::INFO, "%me%ssage%")
|
184
184
|
end
|
185
|
+
|
186
|
+
it "should clean formatted message" do
|
187
|
+
Syslog.stub(:open).and_yield(syslog=double("syslog", :mask= => true))
|
188
|
+
syslog.should_receive(:log).with(Syslog::LOG_INFO, "m%%e%%s%%s%%a%%g%%e")
|
189
|
+
|
190
|
+
original_formatter = @logger.formatter
|
191
|
+
begin
|
192
|
+
@logger.formatter = proc do |severity, datetime, progname, msg|
|
193
|
+
msg.split(//).join('%')
|
194
|
+
end
|
195
|
+
|
196
|
+
@logger.add(Logger::INFO, "message")
|
197
|
+
ensure
|
198
|
+
@logger.formatter = original_formatter
|
199
|
+
end
|
200
|
+
end
|
201
|
+
|
202
|
+
it "should clean tagged message" do
|
203
|
+
Syslog.stub(:open).and_yield(syslog=double("syslog", :mask= => true))
|
204
|
+
syslog.should_receive(:log).with(Syslog::LOG_INFO, "[t%%a%%g%%g%%e%%d] [it] message")
|
205
|
+
|
206
|
+
@logger.tagged("t%a%g%g%e%d") do
|
207
|
+
@logger.tagged("it") do
|
208
|
+
@logger.add(Logger::INFO, "message")
|
209
|
+
end
|
210
|
+
end
|
211
|
+
end
|
185
212
|
|
186
213
|
it "should strip the :message" do
|
187
214
|
Syslog.stub(:open).and_yield(syslog=double("syslog", :mask= => true))
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: syslogger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.6.
|
4
|
+
version: 1.6.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cyril Rohr
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-09-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|