syslogger 1.6.3 → 1.6.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 55d44b66d0d0f21132b492ac60cca50af4b3af74
4
- data.tar.gz: f352bce8e245b7a0766c8f487f1b90cffd1c7aac
3
+ metadata.gz: c21391ce1c6dd9acb99edabd4dcd73a730ddb6c9
4
+ data.tar.gz: 94d556ab7bd1569c0eae7162a2541d9f27aeb6a1
5
5
  SHA512:
6
- metadata.gz: 561f991cf10f575fbcc79780af70ef52f586895ce0aa232d1405ddb957cb9b17847d41b8d02b31108700670ca62ed917a74d4b18567f90f5bd7d6033c447f93e
7
- data.tar.gz: 37c03b6e2241578271de3027587fe06a96c938a0b540a04882c6de58af3b9220964179cd033c38489b9d340cda977dd16e79396f3536ba7c2ceb7510719349f5
6
+ metadata.gz: 6abc0fcc0946fd0950a492b9a09b071d0636b1ebaaca8a5b9e73bf5cdd05589b25bd202b46f6842f222390d20a3e8a59d5b7ae170b6100ef279a43db798c18fc
7
+ data.tar.gz: 716670a2a752274f51874823618bec6874bbf832c14b82a1f51ba13afe7e431948d183cfd3897afce404d97e0d4f5f360dc1a9439f4d02c1d5dba0bffe615658
@@ -4,7 +4,7 @@ require 'thread'
4
4
 
5
5
  class Syslogger
6
6
 
7
- VERSION = "1.6.3"
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 = clean(message || block && block.call)
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
 
@@ -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.3
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-06-16 00:00:00.000000000 Z
11
+ date: 2015-09-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake