logging_assist 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.1.1
@@ -2,9 +2,9 @@ require 'active_support/inflector'
2
2
  require 'log4r'
3
3
  include Log4r
4
4
 
5
- module Rails::Assist::BasicLogging
6
- def log
7
- @log ||= Rails::Assist::Logging.new
5
+ module Rails::Assist::BasicLogger
6
+ def logger
7
+ @logger ||= Rails::Assist::Logging.new
8
8
  end
9
9
  end
10
10
 
@@ -50,8 +50,8 @@ module Rails::Assist
50
50
  add_outputter Log4r::StdoutOutputter.new 'console', :formatter => simple_formatter, :level => get_lv(level)
51
51
  end
52
52
 
53
- def add_logfile level = :debug
54
- add_outputter FileOutputter.new "logfile", :filename => logfile, :formatter => simple_formatter, :level => get_lv(level)
53
+ def add_logfile options = {}
54
+ add_outputter FileOutputter.new "logfile", :filename => options[:logfile] || logfile, :formatter => simple_formatter, :level => get_lv(options[:level] || :debug)
55
55
  end
56
56
 
57
57
  def debug msg
@@ -97,7 +97,7 @@ module Rails::Assist
97
97
  protected
98
98
 
99
99
  def get_lv level = :debug
100
- raise ArgumentError, "Debug lv must be one of #{DEBUG_LVS}" if !DEBUG_LVS.include? level
100
+ raise ArgumentError, "Debug lv must be one of #{DEBUG_LVS}, was #{level}" if !DEBUG_LVS.include? level
101
101
  "Log4r::#{level.to_s.upcase}".constantize
102
102
  end
103
103
 
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{logging_assist}
8
- s.version = "0.1.0"
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 = ["Kristian Mandrup"]
12
- s.date = %q{2010-09-11}
12
+ s.date = %q{2010-09-13}
13
13
  s.description = %q{Wraps logging in a nice and convenient way making it easy to apply on any project}
14
14
  s.email = %q{kmandrup@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  class Abra
4
- include Rails::Assist::BasicLogging
4
+ include Rails::Assist::BasicLogger
5
5
  end
6
6
 
7
7
  describe 'BasicGenerator' do
@@ -10,13 +10,13 @@ describe 'BasicGenerator' do
10
10
  end
11
11
 
12
12
  it "should log to stdout" do
13
- @abra.log.debug 'debugged msg'
14
- @abra.log.info 'info msg here'
13
+ @abra.logger.debug 'debugged msg'
14
+ @abra.logger.info 'info msg here'
15
15
  end
16
16
 
17
17
  it "should log to logfile" do
18
- @abra.log.add_logfile
19
- @abra.log.debug 'debugged msg'
20
- @abra.log.info 'info msg here'
18
+ @abra.logger.add_logfile :logfile => 'here.log'
19
+ @abra.logger.debug 'debugged msg'
20
+ @abra.logger.info 'info msg here'
21
21
  end
22
22
  end
data/spec/spec_helper.rb CHANGED
@@ -1,5 +1,4 @@
1
1
  require 'rspec'
2
- require 'rspec/autorun'
3
2
  require 'logging_assist'
4
3
 
5
4
  RSpec.configure do |config|
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 0
9
- version: 0.1.0
8
+ - 1
9
+ version: 0.1.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - Kristian Mandrup
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-09-11 00:00:00 +02:00
17
+ date: 2010-09-13 00:00:00 +02:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency