yell 0.3.2 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +7 -0
- data/lib/yell/adapters.rb +32 -31
- data/lib/yell/formatter.rb +1 -1
- data/lib/yell/logger.rb +1 -1
- data/lib/yell/version.rb +1 -1
- metadata +49 -35
data/.travis.yml
CHANGED
data/lib/yell/adapters.rb
CHANGED
@@ -15,42 +15,43 @@ module Yell #:nodoc:
|
|
15
15
|
# the logger. You should not have to call the corresponding classes
|
16
16
|
# directly.
|
17
17
|
module Adapters
|
18
|
-
extend self
|
19
|
-
|
20
|
-
# Returns an instance of the given processor type.
|
21
|
-
#
|
22
|
-
# @example A simple file adapter
|
23
|
-
# Yell::Adapters[ :file ]
|
24
|
-
def []( type, options = {}, &block )
|
25
|
-
# return type if type.instance_of?(Yell::Adapters::)
|
26
|
-
|
27
|
-
if type.instance_of?( ::IO )
|
28
|
-
# should apply to STDOUT, STDERR, File, etc
|
29
|
-
Yell::Adapters::Io.new( type, options, &block )
|
30
|
-
else
|
31
|
-
# any other type
|
32
|
-
adapter = case type
|
33
|
-
when String, Symbol then self.const_get( camelize(type.to_s) )
|
34
|
-
else type
|
35
|
-
end
|
36
18
|
|
37
|
-
|
19
|
+
class << self
|
20
|
+
# Returns an instance of the given processor type.
|
21
|
+
#
|
22
|
+
# @example A simple file adapter
|
23
|
+
# Yell::Adapters.new( :file )
|
24
|
+
def new( type, options = {}, &block )
|
25
|
+
# return type if type.instance_of?(Yell::Adapters::)
|
26
|
+
|
27
|
+
if type.instance_of?( ::IO )
|
28
|
+
# should apply to STDOUT, STDERR, File, etc
|
29
|
+
Yell::Adapters::Io.new( type, options, &block )
|
30
|
+
else
|
31
|
+
# any other type
|
32
|
+
adapter = case type
|
33
|
+
when String, Symbol then self.const_get( camelize(type.to_s) )
|
34
|
+
else type
|
35
|
+
end
|
36
|
+
|
37
|
+
adapter.new( options, &block )
|
38
|
+
end
|
38
39
|
end
|
39
|
-
end
|
40
40
|
|
41
41
|
|
42
|
-
|
42
|
+
private
|
43
43
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
44
|
+
# Simple camelcase converter.
|
45
|
+
#
|
46
|
+
# @example
|
47
|
+
# camelize("file")
|
48
|
+
# #=> "File"
|
49
|
+
#
|
50
|
+
# camelize("date_file")
|
51
|
+
# #=> "DateFile"
|
52
|
+
def camelize( str )
|
53
|
+
str.capitalize.gsub( /(_\w)/ ) { |match| match.reverse.chop.upcase }
|
54
|
+
end
|
54
55
|
end
|
55
56
|
|
56
57
|
end
|
data/lib/yell/formatter.rb
CHANGED
@@ -52,7 +52,7 @@ module Yell #:nodoc:
|
|
52
52
|
|
53
53
|
PatternTable = {
|
54
54
|
"m" => "event.message", # Message
|
55
|
-
"l" => "event.level[0]",
|
55
|
+
"l" => "event.level[0,1]", # Level (short), e.g.'I', 'W'
|
56
56
|
"L" => "event.level", # Level, e.g. 'INFO', 'WARN'
|
57
57
|
"d" => "date(event)", # ISO8601 Timestamp
|
58
58
|
"p" => "Process.pid", # PID
|
data/lib/yell/logger.rb
CHANGED
@@ -81,7 +81,7 @@ module Yell #:nodoc:
|
|
81
81
|
h.merge( c.is_a?(String) ? {:filename => c} : c )
|
82
82
|
end
|
83
83
|
|
84
|
-
@adapters << Yell::Adapters
|
84
|
+
@adapters << Yell::Adapters.new( type, options, &block )
|
85
85
|
rescue NameError
|
86
86
|
raise Yell::NoSuchAdapter, type
|
87
87
|
end
|
data/lib/yell/version.rb
CHANGED
metadata
CHANGED
@@ -1,34 +1,43 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: yell
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 3
|
8
|
+
- 3
|
9
|
+
version: 0.3.3
|
6
10
|
platform: ruby
|
7
|
-
authors:
|
11
|
+
authors:
|
8
12
|
- Rudolf Schmidt
|
9
13
|
autorequire:
|
10
14
|
bindir: bin
|
11
15
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
16
|
+
|
17
|
+
date: 2012-03-24 00:00:00 +01:00
|
18
|
+
default_executable:
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
15
21
|
name: rr
|
16
|
-
requirement: &70253484861760 !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
|
-
requirements:
|
19
|
-
- - ! '>='
|
20
|
-
- !ruby/object:Gem::Version
|
21
|
-
version: '0'
|
22
|
-
type: :development
|
23
22
|
prerelease: false
|
24
|
-
|
25
|
-
|
26
|
-
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - ">="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
segments:
|
28
|
+
- 0
|
29
|
+
version: "0"
|
30
|
+
type: :development
|
31
|
+
version_requirements: *id001
|
32
|
+
description: An easy to use logging library to log into files and any other self-defined adapters
|
27
33
|
email:
|
28
34
|
executables: []
|
35
|
+
|
29
36
|
extensions: []
|
37
|
+
|
30
38
|
extra_rdoc_files: []
|
31
|
-
|
39
|
+
|
40
|
+
files:
|
32
41
|
- .gitignore
|
33
42
|
- .travis.yml
|
34
43
|
- Gemfile
|
@@ -60,33 +69,38 @@ files:
|
|
60
69
|
- spec/yell/formatter_spec.rb
|
61
70
|
- spec/yell_spec.rb
|
62
71
|
- yell.gemspec
|
72
|
+
has_rdoc: true
|
63
73
|
homepage: http://rubygems.org/gems/yell
|
64
74
|
licenses: []
|
75
|
+
|
65
76
|
post_install_message:
|
66
77
|
rdoc_options: []
|
67
|
-
|
78
|
+
|
79
|
+
require_paths:
|
68
80
|
- lib
|
69
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
requirements:
|
78
|
-
- -
|
79
|
-
- !ruby/object:Gem::Version
|
80
|
-
|
81
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
82
|
+
requirements:
|
83
|
+
- - ">="
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
segments:
|
86
|
+
- 0
|
87
|
+
version: "0"
|
88
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
89
|
+
requirements:
|
90
|
+
- - ">="
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
segments:
|
93
|
+
- 0
|
94
|
+
version: "0"
|
81
95
|
requirements: []
|
96
|
+
|
82
97
|
rubyforge_project: yell
|
83
|
-
rubygems_version: 1.
|
98
|
+
rubygems_version: 1.3.6
|
84
99
|
signing_key:
|
85
100
|
specification_version: 3
|
86
101
|
summary: Yell - Your Extensible Logging Library
|
87
|
-
test_files:
|
102
|
+
test_files:
|
88
103
|
- spec/spec_helper.rb
|
89
104
|
- spec/yell/event_spec.rb
|
90
105
|
- spec/yell/formatter_spec.rb
|
91
106
|
- spec/yell_spec.rb
|
92
|
-
has_rdoc:
|