yell 0.12.0 → 0.12.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/yell/adapters/base.rb +16 -6
- data/lib/yell/adapters/datefile.rb +4 -4
- data/lib/yell/adapters/file.rb +4 -2
- data/lib/yell/version.rb +1 -1
- data/spec/yell/adapters/file_spec.rb +2 -2
- data/yell.gemspec +1 -0
- metadata +74 -80
data/lib/yell/adapters/base.rb
CHANGED
@@ -92,18 +92,28 @@ module Yell #:nodoc:
|
|
92
92
|
# end
|
93
93
|
def compile!( name, &block )
|
94
94
|
# Get the already defined method
|
95
|
-
m = instance_method name
|
95
|
+
m = instance_method( name )
|
96
96
|
|
97
97
|
# Create a new method with leading underscore
|
98
|
-
define_method "_#{name}", &block
|
99
|
-
_m = instance_method "_#{name}"
|
100
|
-
remove_method "_#{name}"
|
98
|
+
define_method( "_#{name}", &block )
|
99
|
+
_m = instance_method( "_#{name}" )
|
100
|
+
remove_method( "_#{name}" )
|
101
101
|
|
102
102
|
# Define instance method
|
103
|
+
define!( name, _m, m, &block )
|
104
|
+
end
|
105
|
+
|
106
|
+
# Define instance method by given name and call the unbound
|
107
|
+
# methods in order with provided block.
|
108
|
+
def define!( name, *methods, &block )
|
103
109
|
if block.arity == 0
|
104
|
-
define_method(name
|
110
|
+
define_method( name ) do
|
111
|
+
methods.each { |m| m.bind(self).call }
|
112
|
+
end
|
105
113
|
else
|
106
|
-
define_method(name)
|
114
|
+
define_method( name ) do |*args|
|
115
|
+
methods.each { |m| m.bind(self).call(*args) }
|
116
|
+
end
|
107
117
|
end
|
108
118
|
end
|
109
119
|
end
|
@@ -18,11 +18,11 @@ module Yell #:nodoc:
|
|
18
18
|
setup do |options|
|
19
19
|
@date = nil # default; do not override --R
|
20
20
|
|
21
|
-
self.date_pattern = options.fetch(
|
22
|
-
self.symlink_original_filename = options.fetch(
|
23
|
-
self.keep = options.fetch(
|
21
|
+
self.date_pattern = options.fetch(:date_pattern, DefaultDatePattern)
|
22
|
+
self.symlink_original_filename = options.fetch(:symlink_original_filename, false)
|
23
|
+
self.keep = options.fetch(:keep, 0)
|
24
24
|
|
25
|
-
@original_filename = options.fetch(
|
25
|
+
@original_filename = ::File.expand_path options.fetch(:filename, default_filename)
|
26
26
|
options[:filename] = @original_filename
|
27
27
|
end
|
28
28
|
|
data/lib/yell/adapters/file.rb
CHANGED
@@ -8,7 +8,7 @@ module Yell #:nodoc:
|
|
8
8
|
class File < Yell::Adapters::Io
|
9
9
|
|
10
10
|
setup do |options|
|
11
|
-
@filename = options.fetch(
|
11
|
+
@filename = ::File.expand_path options.fetch(:filename, default_filename)
|
12
12
|
end
|
13
13
|
|
14
14
|
|
@@ -27,7 +27,9 @@ module Yell #:nodoc:
|
|
27
27
|
end
|
28
28
|
|
29
29
|
def default_filename #:nodoc:
|
30
|
-
::File.
|
30
|
+
logdir = ::File.expand_path("log")
|
31
|
+
|
32
|
+
::File.expand_path ::File.directory?(logdir) ? "#{logdir}/#{Yell.env}.log" : "#{Yell.env}.log"
|
31
33
|
end
|
32
34
|
|
33
35
|
end
|
data/lib/yell/version.rb
CHANGED
@@ -19,7 +19,7 @@ describe Yell::Adapters::File do
|
|
19
19
|
let( :event ) { Yell::Event.new(1, "Hello World") }
|
20
20
|
|
21
21
|
context "default filename" do
|
22
|
-
let( :filename ) { "#{Yell.env}.log" }
|
22
|
+
let( :filename ) { File.expand_path "#{Yell.env}.log" }
|
23
23
|
let( :adapter ) { Yell::Adapters::File.new }
|
24
24
|
|
25
25
|
it "should print to file" do
|
@@ -30,7 +30,7 @@ describe Yell::Adapters::File do
|
|
30
30
|
end
|
31
31
|
|
32
32
|
context "with given filename" do
|
33
|
-
let( :filename ) { 'filename.log' }
|
33
|
+
let( :filename ) { File.expand_path 'filename.log' }
|
34
34
|
let( :adapter ) { Yell::Adapters::File.new( :filename => filename ) }
|
35
35
|
|
36
36
|
it "should print to file" do
|
data/yell.gemspec
CHANGED
metadata
CHANGED
@@ -1,103 +1,97 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: yell
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.12.0
|
3
|
+
version: !ruby/object:Gem::Version
|
5
4
|
prerelease:
|
5
|
+
version: 0.12.1
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
8
|
-
- Rudolf Schmidt
|
7
|
+
authors:
|
8
|
+
- Rudolf Schmidt
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
|
12
|
+
|
13
|
+
date: 2012-08-29 00:00:00 Z
|
13
14
|
dependencies: []
|
14
|
-
|
15
|
-
|
15
|
+
|
16
|
+
description: Yell - Your Extensible Logging Library. Define multiple adapters, various log level combinations or message formatting options like you've never done before
|
16
17
|
email:
|
17
18
|
executables: []
|
19
|
+
|
18
20
|
extensions: []
|
21
|
+
|
19
22
|
extra_rdoc_files: []
|
20
|
-
|
21
|
-
|
22
|
-
- .
|
23
|
-
-
|
24
|
-
-
|
25
|
-
-
|
26
|
-
-
|
27
|
-
-
|
28
|
-
- examples/
|
29
|
-
- examples/002.
|
30
|
-
- examples/002.
|
31
|
-
- examples/
|
32
|
-
- examples/003.
|
33
|
-
- examples/003.
|
34
|
-
- examples/003.
|
35
|
-
- examples/
|
36
|
-
-
|
37
|
-
- lib/yell
|
38
|
-
- lib/yell/adapters
|
39
|
-
- lib/yell/adapters/
|
40
|
-
- lib/yell/adapters/
|
41
|
-
- lib/yell/adapters/
|
42
|
-
- lib/yell/adapters/
|
43
|
-
- lib/yell/
|
44
|
-
- lib/yell/
|
45
|
-
- lib/yell/
|
46
|
-
- lib/yell/
|
47
|
-
- lib/yell/
|
48
|
-
- lib/yell/
|
49
|
-
-
|
50
|
-
- spec/
|
51
|
-
- spec/
|
52
|
-
- spec/yell/adapters/
|
53
|
-
- spec/yell/adapters/
|
54
|
-
- spec/yell/adapters/
|
55
|
-
- spec/yell/adapters/
|
56
|
-
- spec/yell/
|
57
|
-
- spec/yell/
|
58
|
-
- spec/yell/
|
59
|
-
- spec/yell/
|
60
|
-
- spec/yell/
|
61
|
-
- spec/yell/
|
62
|
-
- spec/
|
63
|
-
-
|
23
|
+
|
24
|
+
files:
|
25
|
+
- .gitignore
|
26
|
+
- .travis.yml
|
27
|
+
- Gemfile
|
28
|
+
- LICENSE.txt
|
29
|
+
- README.md
|
30
|
+
- Rakefile
|
31
|
+
- examples/001-basic-usage.rb
|
32
|
+
- examples/002.1-log-level-basics.rb
|
33
|
+
- examples/002.2-log-level-on-certain-severities-only.rb
|
34
|
+
- examples/002.3-log-level-within-range.rb
|
35
|
+
- examples/003.1-formatting-DefaultFormat.rb
|
36
|
+
- examples/003.2-formatting-BasicFormat.rb
|
37
|
+
- examples/003.3-formatting-ExtendedFormat.rb
|
38
|
+
- examples/003.4-formatting-on-your-own.rb
|
39
|
+
- examples/004.1-colorizing-the-log-output.rb
|
40
|
+
- lib/yell.rb
|
41
|
+
- lib/yell/adapters.rb
|
42
|
+
- lib/yell/adapters/base.rb
|
43
|
+
- lib/yell/adapters/datefile.rb
|
44
|
+
- lib/yell/adapters/file.rb
|
45
|
+
- lib/yell/adapters/io.rb
|
46
|
+
- lib/yell/adapters/streams.rb
|
47
|
+
- lib/yell/configuration.rb
|
48
|
+
- lib/yell/event.rb
|
49
|
+
- lib/yell/formatter.rb
|
50
|
+
- lib/yell/level.rb
|
51
|
+
- lib/yell/logger.rb
|
52
|
+
- lib/yell/version.rb
|
53
|
+
- spec/fixtures/yell.yml
|
54
|
+
- spec/spec_helper.rb
|
55
|
+
- spec/yell/adapters/base_spec.rb
|
56
|
+
- spec/yell/adapters/datefile_spec.rb
|
57
|
+
- spec/yell/adapters/file_spec.rb
|
58
|
+
- spec/yell/adapters/io_spec.rb
|
59
|
+
- spec/yell/adapters/streams_spec.rb
|
60
|
+
- spec/yell/adapters_spec.rb
|
61
|
+
- spec/yell/configuration_spec.rb
|
62
|
+
- spec/yell/event_spec.rb
|
63
|
+
- spec/yell/formatter_spec.rb
|
64
|
+
- spec/yell/level_spec.rb
|
65
|
+
- spec/yell/logger_spec.rb
|
66
|
+
- spec/yell_spec.rb
|
67
|
+
- yell.gemspec
|
64
68
|
homepage: http://rudionrails.github.com/yell
|
65
69
|
licenses: []
|
70
|
+
|
66
71
|
post_install_message:
|
67
72
|
rdoc_options: []
|
68
|
-
|
69
|
-
|
70
|
-
|
73
|
+
|
74
|
+
require_paths:
|
75
|
+
- lib
|
76
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
71
77
|
none: false
|
72
|
-
requirements:
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - ">="
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: "0"
|
82
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
77
83
|
none: false
|
78
|
-
requirements:
|
79
|
-
|
80
|
-
|
81
|
-
|
84
|
+
requirements:
|
85
|
+
- - ">="
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: "0"
|
82
88
|
requirements: []
|
89
|
+
|
83
90
|
rubyforge_project: yell
|
84
|
-
rubygems_version: 1.8.
|
91
|
+
rubygems_version: 1.8.15
|
85
92
|
signing_key:
|
86
93
|
specification_version: 3
|
87
94
|
summary: Yell - Your Extensible Logging Library
|
88
|
-
test_files:
|
89
|
-
|
90
|
-
- spec/spec_helper.rb
|
91
|
-
- spec/yell/adapters/base_spec.rb
|
92
|
-
- spec/yell/adapters/datefile_spec.rb
|
93
|
-
- spec/yell/adapters/file_spec.rb
|
94
|
-
- spec/yell/adapters/io_spec.rb
|
95
|
-
- spec/yell/adapters/streams_spec.rb
|
96
|
-
- spec/yell/adapters_spec.rb
|
97
|
-
- spec/yell/configuration_spec.rb
|
98
|
-
- spec/yell/event_spec.rb
|
99
|
-
- spec/yell/formatter_spec.rb
|
100
|
-
- spec/yell/level_spec.rb
|
101
|
-
- spec/yell/logger_spec.rb
|
102
|
-
- spec/yell_spec.rb
|
95
|
+
test_files: []
|
96
|
+
|
103
97
|
has_rdoc:
|