logging_assist 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/VERSION +1 -1
- data/lib/logging_assist/logging.rb +6 -6
- data/logging_assist.gemspec +2 -2
- data/spec/logging_assist/logging_spec.rb +6 -6
- data/spec/spec_helper.rb +0 -1
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
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::
|
6
|
-
def
|
7
|
-
@
|
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
|
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
|
|
data/logging_assist.gemspec
CHANGED
@@ -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.
|
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-
|
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::
|
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.
|
14
|
-
@abra.
|
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.
|
19
|
-
@abra.
|
20
|
-
@abra.
|
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
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
version: 0.1.
|
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-
|
17
|
+
date: 2010-09-13 00:00:00 +02:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|