hodel_3000_compliant_logger 0.1.0 → 0.1.1

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/.rspec ADDED
@@ -0,0 +1 @@
1
+ --color
data/Gemfile ADDED
@@ -0,0 +1,7 @@
1
+ source "http://rubygems.org"
2
+
3
+ group :development do
4
+ gem 'rspec', ">2.0.0"
5
+ gem 'rake'
6
+ gem 'jeweler'
7
+ end
@@ -0,0 +1,30 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ diff-lcs (1.1.2)
5
+ git (1.2.5)
6
+ jeweler (1.8.4)
7
+ bundler (~> 1.0)
8
+ git (>= 1.2.5)
9
+ rake
10
+ rdoc
11
+ json (1.7.6)
12
+ rake (10.0.3)
13
+ rdoc (3.12)
14
+ json (~> 1.4)
15
+ rspec (2.5.0)
16
+ rspec-core (~> 2.5.0)
17
+ rspec-expectations (~> 2.5.0)
18
+ rspec-mocks (~> 2.5.0)
19
+ rspec-core (2.5.1)
20
+ rspec-expectations (2.5.0)
21
+ diff-lcs (~> 1.1.2)
22
+ rspec-mocks (2.5.0)
23
+
24
+ PLATFORMS
25
+ ruby
26
+
27
+ DEPENDENCIES
28
+ jeweler
29
+ rake
30
+ rspec (> 2.0.0)
@@ -23,19 +23,13 @@ The main thing hodel_3000_complaint_logger provides is the Hodel3000ComplaintLog
23
23
  log.info("Program started")
24
24
  log.warn("Nothing to do!")
25
25
 
26
- Most likely, you'll want to use it to replace the builtin Rails logger, by updating config/environment.rb:
27
-
28
- Rails::Initializer.run do |config|
29
- config.gem 'hodel_3000_compliant_logger'
30
- begin
31
- require 'hodel_3000_compliant_logger'
32
- config.logger = Hodel3000CompliantLogger.new(config.log_path)
33
- rescue
34
- $stderr.puts "Hodel3000CompliantLogger unavailable, oink will be disabled"
35
- end
36
- end
37
-
38
- Note, the block inside Rails::Initializer runs before you environment is fully loaded, so you need this in a begin/rescue block so `rake gems:install` doesn't fall on its face.
26
+ To use hodel_3000_complaint_logger in Rails 3 as a replacement for the default logger, place the following line in your application.rb:
27
+
28
+ config.logger = Hodel3000CompliantLogger.new(config.paths.log.first)
29
+
30
+ In Rails 2, instead use the following in your environment.rb file:
31
+
32
+ config.logger = Hodel3000CompliantLogger.new(config.paths.log.first)
39
33
 
40
34
  === NOTE
41
35
 
data/Rakefile CHANGED
@@ -1,11 +1,11 @@
1
- require 'rubygems'
2
1
  require 'rake'
3
2
 
4
3
  begin
5
4
  require 'jeweler'
5
+
6
6
  Jeweler::Tasks.new do |gem|
7
7
  gem.name = "hodel_3000_compliant_logger"
8
- gem.version = "0.1.0"
8
+ gem.version = "0.1.1"
9
9
  gem.summary = %Q{Alternate logger for Rails that emits syslog-style output. For use with pl_analyze gem.}
10
10
  gem.description = %Q{Alternate logger for Rails that emits syslog-style output. For use with pl_analyze gem.}
11
11
  gem.email = "boss@topfunky.com"
@@ -14,14 +14,16 @@ begin
14
14
  gem.add_development_dependency "rspec", "~> 1.3.0"
15
15
  # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
16
16
  end
17
+
17
18
  Jeweler::GemcutterTasks.new
18
19
  rescue LoadError
19
20
  puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
20
21
  end
21
22
 
22
- require 'spec/rake/spectask'
23
- Spec::Rake::SpecTask.new(:spec) do |spec|
24
- spec.libs << 'lib' << 'spec'
25
- spec.spec_files = FileList['spec/**/*_spec.rb']
26
- end
23
+ require 'rspec/core/rake_task'
24
+
25
+ desc 'Default: run specs.'
27
26
  task :default => :spec
27
+
28
+ desc "Run specs"
29
+ RSpec::Core::RakeTask.new
@@ -1,46 +1,53 @@
1
1
  # Generated by jeweler
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
- s.name = %q{hodel_3000_compliant_logger}
8
- s.version = "0.1.0"
7
+ s.name = "hodel_3000_compliant_logger"
8
+ s.version = "0.1.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Geoffrey Grosenbach"]
12
- s.date = %q{2010-09-30}
13
- s.description = %q{Alternate logger for Rails that emits syslog-style output. For use with pl_analyze gem.}
14
- s.email = %q{boss@topfunky.com}
12
+ s.date = "2013-01-03"
13
+ s.description = "Alternate logger for Rails that emits syslog-style output. For use with pl_analyze gem."
14
+ s.email = "boss@topfunky.com"
15
15
  s.extra_rdoc_files = [
16
16
  "README.rdoc"
17
17
  ]
18
18
  s.files = [
19
+ ".rspec",
20
+ "Gemfile",
21
+ "Gemfile.lock",
19
22
  "README.rdoc",
20
- "Rakefile",
21
- "hodel_3000_compliant_logger.gemspec",
22
- "lib/hodel_3000_compliant_logger.rb",
23
- "spec/hodel_3000_compliant_logger_spec.rb"
24
- ]
25
- s.homepage = %q{http://github.com/topfunky/hodel_3000_compliant_logger}
26
- s.rdoc_options = ["--charset=UTF-8"]
27
- s.require_paths = ["lib"]
28
- s.rubygems_version = %q{1.3.7}
29
- s.summary = %q{Alternate logger for Rails that emits syslog-style output. For use with pl_analyze gem.}
30
- s.test_files = [
23
+ "Rakefile",
24
+ "hodel_3000_compliant_logger.gemspec",
25
+ "lib/hodel_3000_compliant_logger.rb",
31
26
  "spec/hodel_3000_compliant_logger_spec.rb"
32
27
  ]
28
+ s.homepage = "http://github.com/topfunky/hodel_3000_compliant_logger"
29
+ s.require_paths = ["lib"]
30
+ s.rubygems_version = "1.8.24"
31
+ s.summary = "Alternate logger for Rails that emits syslog-style output. For use with pl_analyze gem."
33
32
 
34
33
  if s.respond_to? :specification_version then
35
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
36
34
  s.specification_version = 3
37
35
 
38
36
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
37
+ s.add_development_dependency(%q<rspec>, ["> 2.0.0"])
38
+ s.add_development_dependency(%q<rake>, [">= 0"])
39
+ s.add_development_dependency(%q<jeweler>, [">= 0"])
39
40
  s.add_development_dependency(%q<rspec>, ["~> 1.3.0"])
40
41
  else
42
+ s.add_dependency(%q<rspec>, ["> 2.0.0"])
43
+ s.add_dependency(%q<rake>, [">= 0"])
44
+ s.add_dependency(%q<jeweler>, [">= 0"])
41
45
  s.add_dependency(%q<rspec>, ["~> 1.3.0"])
42
46
  end
43
47
  else
48
+ s.add_dependency(%q<rspec>, ["> 2.0.0"])
49
+ s.add_dependency(%q<rake>, [">= 0"])
50
+ s.add_dependency(%q<jeweler>, [">= 0"])
44
51
  s.add_dependency(%q<rspec>, ["~> 1.3.0"])
45
52
  end
46
53
  end
@@ -1,5 +1,6 @@
1
1
  require 'logger'
2
2
  require 'English'
3
+ require 'socket'
3
4
 
4
5
  # A logger for use with pl_analyze and other tools that expect syslog-style log output.
5
6
  class Hodel3000CompliantLogger < Logger
@@ -1,39 +1,44 @@
1
1
  $: << File.dirname(__FILE__) + "/../lib"
2
2
 
3
- require 'rubygems'
4
- require 'spec'
3
+ require 'rspec'
5
4
  require 'hodel_3000_compliant_logger'
6
5
 
7
- describe Hodel3000CompliantLogger do
6
+ describe Hodel3000CompliantLogger do
8
7
 
9
- before :each do
10
- @out = StringIO.new
11
- @log = Hodel3000CompliantLogger.new(@out)
8
+ before :each do
9
+ @out = StringIO.new
10
+ @log = Hodel3000CompliantLogger.new(@out)
12
11
  Socket.stub(:gethostname).and_return('hostname.domain')
13
- end
14
-
15
- it "should log stuff in a syslog-like format so that Eric Hodel's Rails Analyzer Tools can parse it" do
16
- msg = "Yo ho hello there!"
17
- @log.info(msg)
18
- @out.string.should match(/^\w{3} \d{2} \d{2}:\d{2}:\d{2} hostname rails\[\d+\]: #{msg}\n$/)
19
- end
20
-
21
- it "should handle an Exception object used as an argument in Logger#error, rather than blow chunks" do
22
- @log.error(Exception.new)
23
- @out.string.should match(/Exception/)
24
- end
25
-
26
- it "should display a semi-readable stack trace (albiet on one line) when Logger#error(SomeException) was called" do
27
- @log.error(toss_runtime_error)
28
- @out.string.should match(/.*? \| .*? \| .*? \|/) # pipe separated stack frames
29
- @out.string.should match(/\n$/)
30
- @out.string.count("\n").should == 1
31
- end
32
-
33
- def toss_runtime_error
34
- raise "Catastrophic Failure"
35
- rescue => e
36
- return e
37
- end
12
+ end
13
+
14
+ it "should log stuff in a syslog-like format so that Eric Hodel's Rails Analyzer Tools can parse it" do
15
+ msg = "Yo ho hello there!"
16
+ @log.info(msg)
17
+ @out.string.should match(/^\w{3} \d{2} \d{2}:\d{2}:\d{2} hostname rails\[\d+\]: #{msg}\n$/)
18
+ end
19
+
20
+ it "should handle an Exception object used as an argument in Logger#error, rather than blow chunks" do
21
+ @log.error(Exception.new)
22
+ @out.string.should match(/Exception/)
23
+ end
24
+
25
+ it "should display a semi-readable stack trace (albiet on one line) when Logger#error(SomeException) was called" do
26
+ @log.error(toss_runtime_error)
27
+ @out.string.should match(/.*? \| .*? \| .*? \|/) # pipe separated stack frames
28
+ @out.string.should match(/\n$/)
29
+ @out.string.count("\n").should == 1
30
+ end
31
+
32
+ it "should replace newlines in message with an empty string" do
33
+ msg = "Yo\nho\nhello\nthere!"
34
+ @log.info(msg)
35
+ @out.string.should match(/^\w{3} \d{2} \d{2}:\d{2}:\d{2} hostname rails\[\d+\]: Yohohellothere!\n$/)
36
+ end
37
+
38
+ def toss_runtime_error
39
+ raise "Catastrophic Failure"
40
+ rescue => e
41
+ return e
42
+ end
38
43
  end
39
-
44
+
metadata CHANGED
@@ -1,86 +1,122 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: hodel_3000_compliant_logger
3
- version: !ruby/object:Gem::Version
4
- hash: 27
5
- prerelease: false
6
- segments:
7
- - 0
8
- - 1
9
- - 0
10
- version: 0.1.0
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
5
+ prerelease:
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Geoffrey Grosenbach
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2010-09-30 00:00:00 -04:00
19
- default_executable:
20
- dependencies:
21
- - !ruby/object:Gem::Dependency
12
+ date: 2013-01-03 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
22
15
  name: rspec
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>'
20
+ - !ruby/object:Gem::Version
21
+ version: 2.0.0
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>'
28
+ - !ruby/object:Gem::Version
29
+ version: 2.0.0
30
+ - !ruby/object:Gem::Dependency
31
+ name: rake
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :development
23
39
  prerelease: false
24
- requirement: &id001 !ruby/object:Gem::Requirement
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: jeweler
48
+ requirement: !ruby/object:Gem::Requirement
25
49
  none: false
26
- requirements:
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: rspec
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
27
67
  - - ~>
28
- - !ruby/object:Gem::Version
29
- hash: 27
30
- segments:
31
- - 1
32
- - 3
33
- - 0
68
+ - !ruby/object:Gem::Version
34
69
  version: 1.3.0
35
70
  type: :development
36
- version_requirements: *id001
37
- description: Alternate logger for Rails that emits syslog-style output. For use with pl_analyze gem.
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ~>
76
+ - !ruby/object:Gem::Version
77
+ version: 1.3.0
78
+ description: Alternate logger for Rails that emits syslog-style output. For use with
79
+ pl_analyze gem.
38
80
  email: boss@topfunky.com
39
81
  executables: []
40
-
41
82
  extensions: []
42
-
43
- extra_rdoc_files:
83
+ extra_rdoc_files:
44
84
  - README.rdoc
45
- files:
85
+ files:
86
+ - .rspec
87
+ - Gemfile
88
+ - Gemfile.lock
46
89
  - README.rdoc
47
90
  - Rakefile
48
91
  - hodel_3000_compliant_logger.gemspec
49
92
  - lib/hodel_3000_compliant_logger.rb
50
93
  - spec/hodel_3000_compliant_logger_spec.rb
51
- has_rdoc: true
52
94
  homepage: http://github.com/topfunky/hodel_3000_compliant_logger
53
95
  licenses: []
54
-
55
96
  post_install_message:
56
- rdoc_options:
57
- - --charset=UTF-8
58
- require_paths:
97
+ rdoc_options: []
98
+ require_paths:
59
99
  - lib
60
- required_ruby_version: !ruby/object:Gem::Requirement
100
+ required_ruby_version: !ruby/object:Gem::Requirement
61
101
  none: false
62
- requirements:
63
- - - ">="
64
- - !ruby/object:Gem::Version
65
- hash: 3
66
- segments:
102
+ requirements:
103
+ - - ! '>='
104
+ - !ruby/object:Gem::Version
105
+ version: '0'
106
+ segments:
67
107
  - 0
68
- version: "0"
69
- required_rubygems_version: !ruby/object:Gem::Requirement
108
+ hash: 1288073487739920138
109
+ required_rubygems_version: !ruby/object:Gem::Requirement
70
110
  none: false
71
- requirements:
72
- - - ">="
73
- - !ruby/object:Gem::Version
74
- hash: 3
75
- segments:
76
- - 0
77
- version: "0"
111
+ requirements:
112
+ - - ! '>='
113
+ - !ruby/object:Gem::Version
114
+ version: '0'
78
115
  requirements: []
79
-
80
116
  rubyforge_project:
81
- rubygems_version: 1.3.7
117
+ rubygems_version: 1.8.24
82
118
  signing_key:
83
119
  specification_version: 3
84
- summary: Alternate logger for Rails that emits syslog-style output. For use with pl_analyze gem.
85
- test_files:
86
- - spec/hodel_3000_compliant_logger_spec.rb
120
+ summary: Alternate logger for Rails that emits syslog-style output. For use with pl_analyze
121
+ gem.
122
+ test_files: []