multilogger 0.1.3 → 0.1.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.
data/.gitignore CHANGED
@@ -8,3 +8,4 @@ pkg
8
8
  *.dll
9
9
  *.o
10
10
  Makefile
11
+ *.gemspec
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.3
1
+ 0.1.4
data/lib/multilogger.rb CHANGED
@@ -21,7 +21,7 @@ class MultiLogger < ActiveSupport::BufferedLogger
21
21
 
22
22
  def add(severity, message=nil, progname=nil, &block)
23
23
  @extra_logs.keys.each do |pattern|
24
- if message.match(pattern)
24
+ if message && message.match(pattern)
25
25
  return @extra_logs[pattern].add(severity, message, progname, &block)
26
26
  end
27
27
  end
data/multilogger.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{multilogger}
8
- s.version = "0.1.3"
8
+ s.version = "0.1.4"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Burke Libbey"]
12
- s.date = %q{2010-01-13}
12
+ s.date = %q{2010-01-15}
13
13
  s.description = %q{Multilogger pattern matches incoming log messages to decide which log file to write them to.}
14
14
  s.email = %q{burke@burkelibbey.org}
15
15
  s.extra_rdoc_files = [
@@ -21,13 +21,17 @@ Gem::Specification.new do |s|
21
21
  "Rakefile",
22
22
  "VERSION",
23
23
  "lib/multilogger.rb",
24
- "multilogger.gemspec"
24
+ "multilogger.gemspec",
25
+ "spec/multilogger_spec.rb"
25
26
  ]
26
27
  s.homepage = %q{http://github.com/burke/multilogger}
27
28
  s.rdoc_options = ["--charset=UTF-8"]
28
29
  s.require_paths = ["lib"]
29
30
  s.rubygems_version = %q{1.3.5}
30
31
  s.summary = %q{Split Rails logging into multiple log files}
32
+ s.test_files = [
33
+ "spec/multilogger_spec.rb"
34
+ ]
31
35
 
32
36
  if s.respond_to? :specification_version then
33
37
  current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
@@ -0,0 +1,30 @@
1
+ require 'rubygems'
2
+ require 'active_support'
3
+ require File.join(File.dirname(__FILE__),'../lib/multilogger.rb')
4
+
5
+ describe MultiLogger do
6
+
7
+ before do
8
+ @target = StringIO.new
9
+ @alt_target = StringIO.new
10
+ @log = MultiLogger.new(@target)
11
+ @log.add_log(/p[aA]ttern/, @alt_target)
12
+ end
13
+
14
+ it "should log messages to the supplied IO object" do
15
+ @log.fatal("This will go to the main log.")
16
+ @target.rewind
17
+ @target.read.should == "This will go to the main log.\n"
18
+ @alt_target.rewind
19
+ @alt_target.read.should == ""
20
+ end
21
+
22
+ it "should split messages that match supplied patterns into their respective alternate log files" do
23
+ @log.fatal("This matches the pattern, and will go to the alternate log.")
24
+ @target.rewind
25
+ @target.read.should == ""
26
+ @alt_target.rewind
27
+ @alt_target.read.should == "This matches the pattern, and will go to the alternate log.\n"
28
+ end
29
+
30
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: multilogger
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Burke Libbey
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-01-13 00:00:00 -06:00
12
+ date: 2010-01-15 00:00:00 -06:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -37,6 +37,7 @@ files:
37
37
  - VERSION
38
38
  - lib/multilogger.rb
39
39
  - multilogger.gemspec
40
+ - spec/multilogger_spec.rb
40
41
  has_rdoc: true
41
42
  homepage: http://github.com/burke/multilogger
42
43
  licenses: []
@@ -65,5 +66,5 @@ rubygems_version: 1.3.5
65
66
  signing_key:
66
67
  specification_version: 3
67
68
  summary: Split Rails logging into multiple log files
68
- test_files: []
69
-
69
+ test_files:
70
+ - spec/multilogger_spec.rb