mini_logger 0.5.1 → 0.5.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/mini_logger.rb +3 -3
- data/lib/version.rb +2 -2
- data/test/{unit/test_mini_logger.rb → test_mini_logger.rb} +10 -16
- metadata +45 -71
data/lib/mini_logger.rb
CHANGED
@@ -59,10 +59,10 @@ module MiniLogger
|
|
59
59
|
when Hash
|
60
60
|
configuration.merge!(arguments[0])
|
61
61
|
else
|
62
|
-
configuration = { :dev=>STDERR, :level=>:debug }
|
62
|
+
configuration = { :dev=>STDERR, :level=>:debug }
|
63
63
|
end
|
64
64
|
|
65
|
-
configuration
|
65
|
+
configuration = { :log_channel=>STDERR, :log_level=>:info }.merge(configuration)
|
66
66
|
|
67
67
|
configuration[:dev] = configuration[:log_channel] unless configuration[:dev]
|
68
68
|
configuration[:level] = configuration[:log_level] unless configuration[:level]
|
@@ -117,4 +117,4 @@ module MiniLogger
|
|
117
117
|
@logger.send(method, *arguments, &block)
|
118
118
|
end
|
119
119
|
end
|
120
|
-
end
|
120
|
+
end
|
data/lib/version.rb
CHANGED
@@ -1,13 +1,11 @@
|
|
1
|
+
$:.unshift(File.dirname(__FILE__))
|
2
|
+
|
1
3
|
require 'rubygems'
|
2
4
|
require 'tmpdir'
|
3
5
|
require 'test/unit'
|
4
6
|
require 'file/tail'
|
5
7
|
require 'mini_logger'
|
6
|
-
|
7
|
-
|
8
|
-
$:.unshift(File.join(File.dirname(__FILE__), %w[.. helpers]))
|
9
|
-
|
10
|
-
require 'tail_file_helper'
|
8
|
+
require 'helpers/tail_file_helper'
|
11
9
|
|
12
10
|
|
13
11
|
class TestMiniLogger < Test::Unit::TestCase
|
@@ -17,18 +15,15 @@ class TestMiniLogger < Test::Unit::TestCase
|
|
17
15
|
TEST_WARN_MESSAGE = "warn"
|
18
16
|
TEST_ERROR_MESSAGE = "error"
|
19
17
|
TEST_FATAL_MESSAGE = "fatal"
|
20
|
-
|
21
18
|
|
22
19
|
|
23
20
|
def test_validate_log_level
|
24
21
|
|
25
22
|
[:debug, 'info', :warn, 'error', :fatal].each do |l|
|
26
|
-
|
27
23
|
assert(MiniLogger.validate_log_level?(l), "Log level:'#{l} not validated")
|
28
24
|
end
|
29
25
|
|
30
26
|
[:foo, 'bar', :bazz].each do |l|
|
31
|
-
|
32
27
|
assert(!MiniLogger.validate_log_level?(l), "Log level:'#{l} validated")
|
33
28
|
end
|
34
29
|
end
|
@@ -62,25 +57,24 @@ class TestMiniLogger < Test::Unit::TestCase
|
|
62
57
|
|
63
58
|
##
|
64
59
|
# Old configuration interface
|
65
|
-
test_logger = MiniLogger.configure(:log_channel=>STDERR, :log_level=>:
|
66
|
-
assert(test_logger.
|
60
|
+
test_logger = MiniLogger.configure(:log_channel=>STDERR, :log_level=>:info)
|
61
|
+
assert(test_logger.info?, "Log level:'#{test_logger.level}'")
|
67
62
|
|
68
63
|
##
|
69
64
|
# Mix configuration interface
|
70
|
-
test_logger = MiniLogger.configure(:log_channel=>STDERR, :level=>:
|
71
|
-
assert(test_logger.
|
65
|
+
test_logger = MiniLogger.configure(:log_channel=>STDERR, :level=>:warn)
|
66
|
+
assert(test_logger.warn?, "Log level:'#{test_logger.level}")
|
72
67
|
|
73
68
|
##
|
74
69
|
# Mix configuration interface
|
75
|
-
test_logger = MiniLogger.configure(:dev=>STDERR, :log_level=>:
|
76
|
-
assert(test_logger.
|
70
|
+
test_logger = MiniLogger.configure(:dev=>STDERR, :log_level=>:error)
|
71
|
+
assert(test_logger.error?, "Log level:'#{test_logger.level}")
|
77
72
|
end
|
78
73
|
|
79
74
|
|
80
75
|
def test_raise_and_argument_error
|
81
76
|
|
82
77
|
[:this, 'set', :of, 'log', :levels, 'are', :evil].each do |l|
|
83
|
-
|
84
78
|
assert_raise(ArgumentError) { MiniLogger.configure(:level=>l) }
|
85
79
|
end
|
86
80
|
end
|
@@ -88,7 +82,7 @@ class TestMiniLogger < Test::Unit::TestCase
|
|
88
82
|
|
89
83
|
def test_create_a_logger_from_a_configuration_file
|
90
84
|
|
91
|
-
assert_equal(MiniLogger.configure(File.join(File.dirname(__FILE__), %w[
|
85
|
+
assert_equal(MiniLogger.configure(File.join(File.dirname(__FILE__), %w[fixtures test_config.yml])).level, MiniLogger::ERROR)
|
92
86
|
assert_raise(Errno::ENOENT) { MiniLogger.configure("ThisFileDoNotExist.yml") }
|
93
87
|
end
|
94
88
|
|
metadata
CHANGED
@@ -1,110 +1,84 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: mini_logger
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.5.2
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 5
|
9
|
-
- 1
|
10
|
-
version: 0.5.1
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Javier Juarez
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
requirement: &
|
12
|
+
date: 2011-07-01 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: jeweler
|
16
|
+
requirement: &2152470300 !ruby/object:Gem::Requirement
|
22
17
|
none: false
|
23
|
-
requirements:
|
24
|
-
- -
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
|
27
|
-
segments:
|
28
|
-
- 0
|
29
|
-
version: "0"
|
30
|
-
version_requirements: *id001
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
31
22
|
type: :development
|
32
|
-
name: jeweler
|
33
23
|
prerelease: false
|
34
|
-
|
35
|
-
|
24
|
+
version_requirements: *2152470300
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: file-tail
|
27
|
+
requirement: &2152469360 !ruby/object:Gem::Requirement
|
36
28
|
none: false
|
37
|
-
requirements:
|
38
|
-
- -
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
|
41
|
-
segments:
|
42
|
-
- 0
|
43
|
-
version: "0"
|
44
|
-
version_requirements: *id002
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
45
33
|
type: :development
|
46
|
-
name: file-tail
|
47
34
|
prerelease: false
|
48
|
-
|
49
|
-
|
35
|
+
version_requirements: *2152469360
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: rcov
|
38
|
+
requirement: &2152468300 !ruby/object:Gem::Requirement
|
50
39
|
none: false
|
51
|
-
requirements:
|
52
|
-
- -
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
|
55
|
-
segments:
|
56
|
-
- 0
|
57
|
-
version: "0"
|
58
|
-
version_requirements: *id003
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
59
44
|
type: :development
|
60
|
-
name: rcov
|
61
45
|
prerelease: false
|
46
|
+
version_requirements: *2152468300
|
62
47
|
description: A minimal standard Logger wrapper perfect for CLI applications
|
63
48
|
email: javier.juarez@gmail.com
|
64
49
|
executables: []
|
65
|
-
|
66
50
|
extensions: []
|
67
|
-
|
68
|
-
extra_rdoc_files:
|
51
|
+
extra_rdoc_files:
|
69
52
|
- README.rdoc
|
70
|
-
files:
|
53
|
+
files:
|
71
54
|
- lib/mini_logger.rb
|
72
55
|
- lib/version.rb
|
73
56
|
- test/helpers/tail_file_helper.rb
|
74
|
-
- test/
|
57
|
+
- test/test_mini_logger.rb
|
75
58
|
- README.rdoc
|
76
59
|
homepage: http://github.com/jjuarez/mini_logger
|
77
|
-
licenses:
|
60
|
+
licenses:
|
78
61
|
- MIT
|
79
62
|
post_install_message:
|
80
63
|
rdoc_options: []
|
81
|
-
|
82
|
-
require_paths:
|
64
|
+
require_paths:
|
83
65
|
- lib
|
84
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
66
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
85
67
|
none: false
|
86
|
-
requirements:
|
87
|
-
- -
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
|
90
|
-
|
91
|
-
- 0
|
92
|
-
version: "0"
|
93
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
68
|
+
requirements:
|
69
|
+
- - ! '>='
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: '0'
|
72
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
94
73
|
none: false
|
95
|
-
requirements:
|
96
|
-
- -
|
97
|
-
- !ruby/object:Gem::Version
|
98
|
-
|
99
|
-
segments:
|
100
|
-
- 0
|
101
|
-
version: "0"
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
102
78
|
requirements: []
|
103
|
-
|
104
79
|
rubyforge_project: http://github.com/jjuarez/mini_logger
|
105
80
|
rubygems_version: 1.8.5
|
106
81
|
signing_key:
|
107
82
|
specification_version: 3
|
108
83
|
summary: A tiny logger utility for small applications
|
109
84
|
test_files: []
|
110
|
-
|