yell 2.1.0 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -1
- data/.travis.yml +8 -13
- data/examples/002.1-log-level-basics.rb +2 -2
- data/examples/002.2-log-level-on-certain-severities-only.rb +5 -4
- data/examples/002.3-log-level-within-range.rb +7 -5
- data/examples/003.1-formatting-DefaultFormat.rb +3 -3
- data/examples/003.2-formatting-BasicFormat.rb +3 -3
- data/examples/003.3-formatting-ExtendedFormat.rb +3 -3
- data/examples/003.4-formatting-on-your-own.rb +3 -3
- data/examples/004.1-colorizing-the-log-output.rb +3 -3
- data/examples/005.1-repository.rb +3 -3
- data/examples/006.1-the-loggable-module.rb +2 -2
- data/examples/006.2-the-loggable-module-with-inheritance.rb +2 -2
- data/lib/core_ext/logger.rb +1 -2
- data/lib/yell/adapters/base.rb +1 -1
- data/lib/yell/adapters/datefile.rb +6 -6
- data/lib/yell/adapters/file.rb +1 -1
- data/lib/yell/adapters/io.rb +2 -2
- data/lib/yell/formatter.rb +4 -4
- data/lib/yell/helpers/adapter.rb +2 -2
- data/lib/yell/loggable.rb +1 -1
- data/lib/yell/logger.rb +6 -6
- data/lib/yell/version.rb +1 -1
- data/spec/compatibility/level_spec.rb +23 -5
- data/spec/yell/formatter_spec.rb +2 -2
- data/spec/yell/level_spec.rb +1 -1
- data/spec/yell/logger_spec.rb +19 -19
- data/spec/yell/repository_spec.rb +4 -4
- data/yell.gemspec +11 -2
- metadata +10 -6
- data/Gemfile.lte-1.9.3 +0 -17
- data/Gemfile.lte-2.2.2 +0 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 59a2ae83c97bc78309f37e66af22d46d374c468b
|
4
|
+
data.tar.gz: 85bcce8202f4460472dab37ad325f31c1217e19c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 617fbc94646ed5af6afee6c4be76d1ed0628664cf747e3dd070f137a5338271ca9302795f6a270c11f4c77ab4bd780b78d4b79b820e8e303d11a0886ba8d24d3
|
7
|
+
data.tar.gz: 4c66343d5d7b3cd723231c773c2c359a74e5a4804e68a2bd8ab2f031a9b54937dccd00b1a1561f82f963578bb89da90db1bd1647d4ddecf5545d2535791c6c70
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
@@ -5,20 +5,15 @@ script: "bundle exec rspec"
|
|
5
5
|
matrix:
|
6
6
|
include:
|
7
7
|
- rvm: ruby-head
|
8
|
-
- rvm: 2.
|
9
|
-
- rvm: 2.
|
10
|
-
|
11
|
-
- rvm: 2.
|
12
|
-
|
13
|
-
- rvm: 2
|
14
|
-
|
15
|
-
- rvm:
|
16
|
-
gemfile: Gemfile.lte-2.2.2
|
17
|
-
|
8
|
+
- rvm: 2.6
|
9
|
+
- rvm: 2.5
|
10
|
+
- rvm: 2.4
|
11
|
+
- rvm: 2.3
|
12
|
+
- rvm: jruby-9.1
|
13
|
+
- rvm: jruby-9.2
|
14
|
+
allow_failures:
|
15
|
+
- rvm: ruby-head
|
18
16
|
- rvm: jruby-head
|
19
|
-
- rvm: jruby-9.1.12.0
|
20
|
-
- rvm: jruby-9.0.0.0
|
21
|
-
gemfile: Gemfile.lte-2.2.2
|
22
17
|
|
23
18
|
notifications:
|
24
19
|
on_success: change
|
@@ -7,7 +7,7 @@ puts <<-EOS
|
|
7
7
|
# Like many other logging libraries, Yell allows you to define from which level
|
8
8
|
# onwards you want to write your log message.
|
9
9
|
|
10
|
-
logger = Yell.new STDOUT, :
|
10
|
+
logger = Yell.new STDOUT, level: :info
|
11
11
|
|
12
12
|
logger.debug "This is a :debug message"
|
13
13
|
#=> nil
|
@@ -19,7 +19,7 @@ logger.info "This is a :info message"
|
|
19
19
|
EOS
|
20
20
|
|
21
21
|
puts "=== actual example ==="
|
22
|
-
logger = Yell.new STDOUT, :
|
22
|
+
logger = Yell.new STDOUT, level: :info
|
23
23
|
|
24
24
|
logger.debug "This is a :debug message"
|
25
25
|
logger.info "This is a :info message"
|
@@ -7,10 +7,11 @@ puts <<-EOS
|
|
7
7
|
# The Yell::Level parser allows you to exactly specify on which levels to log,
|
8
8
|
# ignoring all the others. For instance: If we want to only log at the :debug
|
9
9
|
# and :warn levels we simply providing an array:
|
10
|
+
# * %i[] is a built-in for an array of symbols
|
10
11
|
|
11
|
-
logger = Yell.new STDOUT, :
|
12
|
+
logger = Yell.new STDOUT, level: %i[debug warn]
|
12
13
|
|
13
|
-
[
|
14
|
+
%i[debug info warn error fatal].each do |level|
|
14
15
|
logger.send( level, level )
|
15
16
|
end
|
16
17
|
#=> "2012-02-29T09:30:00+01:00 [DEBUG] 65784 : debug"
|
@@ -20,9 +21,9 @@ end
|
|
20
21
|
EOS
|
21
22
|
|
22
23
|
puts "=== actual example ==="
|
23
|
-
logger = Yell.new STDOUT, :
|
24
|
+
logger = Yell.new STDOUT, level: %i[debug warn]
|
24
25
|
|
25
|
-
[
|
26
|
+
%i[debug info warn error fatal].each do |level|
|
26
27
|
logger.send( level, level )
|
27
28
|
end
|
28
29
|
|
@@ -6,10 +6,12 @@ puts <<-EOS
|
|
6
6
|
|
7
7
|
# Additionally to writing only on specific levels, you may pass a range to
|
8
8
|
# the :level option:
|
9
|
+
# * %i[] is a built-in for an array of symbols
|
9
10
|
|
10
|
-
logger = Yell.new STDOUT, :level => (:debug..:warn)
|
11
11
|
|
12
|
-
|
12
|
+
logger = Yell.new STDOUT, level: (:debug..:warn)
|
13
|
+
|
14
|
+
%i[debug info warn error fatal].each do |level|
|
13
15
|
logger.send( level, level )
|
14
16
|
end
|
15
17
|
#=> "2012-02-29T09:30:00+01:00 [DEBUG] 65784 : debug"
|
@@ -19,10 +21,10 @@ end
|
|
19
21
|
|
20
22
|
EOS
|
21
23
|
|
22
|
-
puts "===
|
23
|
-
logger = Yell.new STDOUT, :
|
24
|
+
puts "=== actual example ==="
|
25
|
+
logger = Yell.new STDOUT, level: (:debug..:warn)
|
24
26
|
|
25
|
-
[
|
27
|
+
%i[debug info warn error fatal].each do |level|
|
26
28
|
logger.send( level, level )
|
27
29
|
end
|
28
30
|
|
@@ -7,7 +7,7 @@ puts <<-EOS
|
|
7
7
|
# The default formatting string looks like: %d [%5L] %p : %m and is used when
|
8
8
|
# nothing else is defined.
|
9
9
|
|
10
|
-
logger = Yell.new STDOUT, :
|
10
|
+
logger = Yell.new STDOUT, format: Yell::DefaultFormat
|
11
11
|
logger.info "Hello World!"
|
12
12
|
#=> "2012-02-29T09:30:00+01:00 [ INFO] 65784 : Hello World!"
|
13
13
|
# ^ ^ ^ ^
|
@@ -16,7 +16,7 @@ logger.info "Hello World!"
|
|
16
16
|
|
17
17
|
EOS
|
18
18
|
|
19
|
-
puts "===
|
20
|
-
logger = Yell.new STDOUT, :
|
19
|
+
puts "=== actual example ==="
|
20
|
+
logger = Yell.new STDOUT, format: Yell::DefaultFormat
|
21
21
|
logger.info "Hello World!"
|
22
22
|
|
@@ -6,7 +6,7 @@ puts <<-EOS
|
|
6
6
|
|
7
7
|
# The basic formating string looks like: %l, %d: %m.
|
8
8
|
|
9
|
-
logger = Yell.new STDOUT, :
|
9
|
+
logger = Yell.new STDOUT, format: Yell::BasicFormat
|
10
10
|
logger.info "Hello World!"
|
11
11
|
#=> "I, 2012-02-29T09:30:00+01:00 : Hello World!"
|
12
12
|
# ^ ^ ^
|
@@ -16,7 +16,7 @@ logger.info "Hello World!"
|
|
16
16
|
|
17
17
|
EOS
|
18
18
|
|
19
|
-
puts "===
|
20
|
-
logger = Yell.new STDOUT, :
|
19
|
+
puts "=== actual example ==="
|
20
|
+
logger = Yell.new STDOUT, format: Yell::BasicFormat
|
21
21
|
logger.info "Hello World!"
|
22
22
|
|
@@ -6,7 +6,7 @@ puts <<-EOS
|
|
6
6
|
|
7
7
|
# The extended formatting string looks like: %d [%5L] %p %h : %m.
|
8
8
|
|
9
|
-
logger = Yell.new STDOUT, :
|
9
|
+
logger = Yell.new STDOUT, format: Yell::ExtendedFormat
|
10
10
|
logger.info "Hello World!"
|
11
11
|
#=> "2012-02-29T09:30:00+01:00 [ INFO] 65784 localhost : Hello World!"
|
12
12
|
# ^ ^ ^ ^ ^
|
@@ -15,7 +15,7 @@ logger.info "Hello World!"
|
|
15
15
|
|
16
16
|
EOS
|
17
17
|
|
18
|
-
puts "===
|
19
|
-
logger = Yell.new STDOUT, :
|
18
|
+
puts "=== actual example ==="
|
19
|
+
logger = Yell.new STDOUT, format: Yell::ExtendedFormat
|
20
20
|
logger.info "Hello World!"
|
21
21
|
|
@@ -6,7 +6,7 @@ puts <<-EOS
|
|
6
6
|
|
7
7
|
# The extended formatting string looks like: %d [%5L] %p %h : %m.
|
8
8
|
|
9
|
-
logger = Yell.new STDOUT, :
|
9
|
+
logger = Yell.new STDOUT, format: "[%f:%n in `%M'] %m", trace: true
|
10
10
|
logger.info "Hello World!"
|
11
11
|
#=> [003.4-formatting-on-your-own.rb:20 in `<main>'] Hello World!
|
12
12
|
# ^ ^ ^ ^
|
@@ -15,7 +15,7 @@ logger.info "Hello World!"
|
|
15
15
|
|
16
16
|
EOS
|
17
17
|
|
18
|
-
puts "===
|
19
|
-
logger = Yell.new STDOUT, :
|
18
|
+
puts "=== actual example ==="
|
19
|
+
logger = Yell.new STDOUT, format: "[%f:%n in `%M'] %m", trace: true
|
20
20
|
logger.info "Hello World!"
|
21
21
|
|
@@ -6,7 +6,7 @@ puts <<-EOS
|
|
6
6
|
|
7
7
|
You may colorize the log output on your io-based loggers loke so:
|
8
8
|
|
9
|
-
logger = Yell.new STDOUT, :
|
9
|
+
logger = Yell.new STDOUT, colors: true
|
10
10
|
|
11
11
|
Yell::Severities.each do |level|
|
12
12
|
logger.send level.downcase, level
|
@@ -14,8 +14,8 @@ end
|
|
14
14
|
|
15
15
|
EOS
|
16
16
|
|
17
|
-
puts "===
|
18
|
-
logger = Yell.new STDOUT, :
|
17
|
+
puts "=== actual example ==="
|
18
|
+
logger = Yell.new STDOUT, colors: true
|
19
19
|
|
20
20
|
Yell::Severities.each do |level|
|
21
21
|
logger.send level.downcase, level
|
@@ -7,7 +7,7 @@ puts <<-EOS
|
|
7
7
|
# You can add a logger to the global repository.
|
8
8
|
#
|
9
9
|
# create a logger named 'mylog' that logs to stdout
|
10
|
-
Yell.new :stdout, :
|
10
|
+
Yell.new :stdout, name: 'mylog'
|
11
11
|
|
12
12
|
# Later in the code, you can get your logger back
|
13
13
|
Yell['mylog'].info "Hello World!"
|
@@ -15,7 +15,7 @@ Yell['mylog'].info "Hello World!"
|
|
15
15
|
|
16
16
|
EOS
|
17
17
|
|
18
|
-
puts "===
|
19
|
-
Yell.new :stdout, :
|
18
|
+
puts "=== actual example ==="
|
19
|
+
Yell.new :stdout, name: 'mylog'
|
20
20
|
Yell['mylog'].info "Hello World!"
|
21
21
|
|
@@ -10,7 +10,7 @@ puts <<-EOS
|
|
10
10
|
# can use it, though, you will need to define a logger providing the :name of
|
11
11
|
# your class.
|
12
12
|
|
13
|
-
Yell.new :stdout, :
|
13
|
+
Yell.new :stdout, name: 'Foo'
|
14
14
|
|
15
15
|
# Define the class
|
16
16
|
class Foo
|
@@ -26,7 +26,7 @@ EOS
|
|
26
26
|
|
27
27
|
puts "=== actual example ==="
|
28
28
|
|
29
|
-
Yell.new :stdout, :
|
29
|
+
Yell.new :stdout, name: 'Foo'
|
30
30
|
|
31
31
|
class Foo
|
32
32
|
include Yell::Loggable
|
@@ -10,7 +10,7 @@ puts <<-EOS
|
|
10
10
|
# can use it, though, you will need to define a logger providing the :name of
|
11
11
|
# your class.
|
12
12
|
|
13
|
-
Yell.new :stdout, :
|
13
|
+
Yell.new :stdout, name: 'Foo'
|
14
14
|
|
15
15
|
# Define the class
|
16
16
|
class Foo
|
@@ -28,7 +28,7 @@ EOS
|
|
28
28
|
|
29
29
|
puts "=== actual example ==="
|
30
30
|
|
31
|
-
Yell.new :stdout, :
|
31
|
+
Yell.new :stdout, name: 'Foo'
|
32
32
|
|
33
33
|
class Foo
|
34
34
|
include Yell::Loggable
|
data/lib/core_ext/logger.rb
CHANGED
@@ -3,7 +3,7 @@ require 'logger'
|
|
3
3
|
class Logger
|
4
4
|
|
5
5
|
def level_with_yell=( level )
|
6
|
-
self.level_without_yell= Integer(level)
|
6
|
+
self.level_without_yell= level.is_a?(Yell::Level) ? Integer(level) : level
|
7
7
|
end
|
8
8
|
alias_method :level_without_yell=, :level=
|
9
9
|
alias_method :level=, :level_with_yell=
|
@@ -15,4 +15,3 @@ class Logger
|
|
15
15
|
alias_method :add, :add_with_yell
|
16
16
|
|
17
17
|
end
|
18
|
-
|
data/lib/yell/adapters/base.rb
CHANGED
@@ -208,7 +208,7 @@ module Yell #:nodoc:
|
|
208
208
|
# Determine whether to write at the given severity.
|
209
209
|
#
|
210
210
|
# @example
|
211
|
-
# write? Yell::Event.new( 'INFO', '
|
211
|
+
# write? Yell::Event.new( 'INFO', 'Hello Wold!' )
|
212
212
|
#
|
213
213
|
# @param [Yell::Event] event The log event
|
214
214
|
#
|
@@ -52,12 +52,12 @@ module Yell #:nodoc:
|
|
52
52
|
|
53
53
|
# @overload setup!( options )
|
54
54
|
def setup!( options )
|
55
|
-
self.header = Yell.__fetch__(options, :header, :
|
56
|
-
self.date_pattern = Yell.__fetch__(options, :date_pattern, :
|
57
|
-
self.keep = Yell.__fetch__(options, :keep, :
|
58
|
-
self.symlink = Yell.__fetch__(options, :symlink, :
|
55
|
+
self.header = Yell.__fetch__(options, :header, default: true)
|
56
|
+
self.date_pattern = Yell.__fetch__(options, :date_pattern, default: DefaultDatePattern)
|
57
|
+
self.keep = Yell.__fetch__(options, :keep, default: false)
|
58
|
+
self.symlink = Yell.__fetch__(options, :symlink, default: true)
|
59
59
|
|
60
|
-
@original_filename = ::File.expand_path(Yell.__fetch__(options, :filename, :
|
60
|
+
@original_filename = ::File.expand_path(Yell.__fetch__(options, :filename, default: default_filename))
|
61
61
|
options[:filename] = @original_filename
|
62
62
|
|
63
63
|
@date = Time.now
|
@@ -182,7 +182,7 @@ module Yell #:nodoc:
|
|
182
182
|
|
183
183
|
# @overload inspectables
|
184
184
|
def inspectables
|
185
|
-
super.concat [
|
185
|
+
super.concat %i[date_pattern header keep symlink]
|
186
186
|
end
|
187
187
|
|
188
188
|
end
|
data/lib/yell/adapters/file.rb
CHANGED
@@ -9,7 +9,7 @@ module Yell #:nodoc:
|
|
9
9
|
|
10
10
|
# @overload setup!( options )
|
11
11
|
def setup!( options )
|
12
|
-
@filename = ::File.expand_path(Yell.__fetch__(options, :filename, :
|
12
|
+
@filename = ::File.expand_path(Yell.__fetch__(options, :filename, default: default_filename))
|
13
13
|
|
14
14
|
super
|
15
15
|
end
|
data/lib/yell/adapters/io.rb
CHANGED
@@ -42,9 +42,9 @@ module Yell #:nodoc:
|
|
42
42
|
def setup!( options )
|
43
43
|
@stream = nil
|
44
44
|
|
45
|
-
self.colors = Yell.__fetch__(options, :colors, :
|
45
|
+
self.colors = Yell.__fetch__(options, :colors, default: false)
|
46
46
|
self.formatter = Yell.__fetch__(options, :format, :formatter)
|
47
|
-
self.sync = Yell.__fetch__(options, :sync, :
|
47
|
+
self.sync = Yell.__fetch__(options, :sync, default: true)
|
48
48
|
|
49
49
|
super
|
50
50
|
end
|
data/lib/yell/formatter.rb
CHANGED
@@ -13,7 +13,7 @@ module Yell #:nodoc:
|
|
13
13
|
# No format on the log message
|
14
14
|
#
|
15
15
|
# @example
|
16
|
-
# logger = Yell.new STDOUT, :
|
16
|
+
# logger = Yell.new STDOUT, format: false
|
17
17
|
# logger.info "Hello World!"
|
18
18
|
# #=> "Hello World!"
|
19
19
|
NoFormat = "%m"
|
@@ -21,7 +21,7 @@ module Yell #:nodoc:
|
|
21
21
|
# Default Format
|
22
22
|
#
|
23
23
|
# @example
|
24
|
-
# logger = Yell.new STDOUT, :
|
24
|
+
# logger = Yell.new STDOUT, format: Yell::DefaultFormat
|
25
25
|
# logger.info "Hello World!"
|
26
26
|
# #=> "2012-02-29T09:30:00+01:00 [ INFO] 65784 : Hello World!"
|
27
27
|
# # ^ ^ ^ ^
|
@@ -31,7 +31,7 @@ module Yell #:nodoc:
|
|
31
31
|
# Basic Format
|
32
32
|
#
|
33
33
|
# @example
|
34
|
-
# logger = Yell.new STDOUT, :
|
34
|
+
# logger = Yell.new STDOUT, format: Yell::BasicFormat
|
35
35
|
# logger.info "Hello World!"
|
36
36
|
# #=> "I, 2012-02-29T09:30:00+01:00 : Hello World!"
|
37
37
|
# # ^ ^ ^
|
@@ -42,7 +42,7 @@ module Yell #:nodoc:
|
|
42
42
|
# Extended Format
|
43
43
|
#
|
44
44
|
# @example
|
45
|
-
# logger = Yell.new STDOUT, :
|
45
|
+
# logger = Yell.new STDOUT, format: Yell::ExtendedFormat
|
46
46
|
# logger.info "Hello World!"
|
47
47
|
# #=> "2012-02-29T09:30:00+01:00 [ INFO] 65784 localhost : Hello World!"
|
48
48
|
# # ^ ^ ^ ^ ^
|
data/lib/yell/helpers/adapter.rb
CHANGED
@@ -10,10 +10,10 @@ module Yell #:nodoc:
|
|
10
10
|
# adapter :file, 'development.log'
|
11
11
|
#
|
12
12
|
# # Alternative notation for filename in options
|
13
|
-
# adapter :file, :
|
13
|
+
# adapter :file, filename: 'developent.log'
|
14
14
|
#
|
15
15
|
# @example Standard adapter with filename and additional options
|
16
|
-
# adapter :file, 'development.log', :
|
16
|
+
# adapter :file, 'development.log', level: :warn
|
17
17
|
#
|
18
18
|
# @example Set the adapter directly from an adapter instance
|
19
19
|
# adapter Yell::Adapter::File.new
|
data/lib/yell/loggable.rb
CHANGED
data/lib/yell/logger.rb
CHANGED
@@ -26,14 +26,14 @@ module Yell #:nodoc:
|
|
26
26
|
# Yell::Logger.new :datefile, 'development.log'
|
27
27
|
#
|
28
28
|
# @example Setting the log level
|
29
|
-
# Yell::Logger.new :
|
29
|
+
# Yell::Logger.new level: :warn
|
30
30
|
#
|
31
31
|
# Yell::Logger.new do |l|
|
32
32
|
# l.level = :warn
|
33
33
|
# end
|
34
34
|
#
|
35
35
|
# @example Combined settings
|
36
|
-
# Yell::Logger.new 'development.log', :
|
36
|
+
# Yell::Logger.new 'development.log', level: :warn
|
37
37
|
#
|
38
38
|
# Yell::Logger.new :datefile, 'development.log' do |l|
|
39
39
|
# l.level = :info
|
@@ -53,13 +53,13 @@ module Yell #:nodoc:
|
|
53
53
|
self.formatter = Yell.__fetch__(@options, :format, :formatter)
|
54
54
|
self.level = Yell.__fetch__(@options, :level, :default => 0)
|
55
55
|
self.name = Yell.__fetch__(@options, :name)
|
56
|
-
self.trace = Yell.__fetch__(@options, :trace, :
|
56
|
+
self.trace = Yell.__fetch__(@options, :trace, default: :error)
|
57
57
|
|
58
58
|
# silencer
|
59
|
-
self.silence(*Yell.__fetch__(@options, :silence, :
|
59
|
+
self.silence(*Yell.__fetch__(@options, :silence, default: []))
|
60
60
|
|
61
61
|
# adapters may be passed in the options
|
62
|
-
extract!(*Yell.__fetch__(@options, :adapters, :
|
62
|
+
extract!(*Yell.__fetch__(@options, :adapters, default: []))
|
63
63
|
|
64
64
|
# extract adapter
|
65
65
|
self.adapter(args.pop) if args.any?
|
@@ -140,7 +140,7 @@ module Yell #:nodoc:
|
|
140
140
|
# extract!(:stdout, :stderr)
|
141
141
|
#
|
142
142
|
# @example
|
143
|
-
# extract!(:
|
143
|
+
# extract!(stdout: {level: :info}, stderr: {level: :error})
|
144
144
|
def extract!( *list )
|
145
145
|
list.each do |a|
|
146
146
|
if a.is_a?(Hash)
|
data/lib/yell/version.rb
CHANGED
@@ -2,17 +2,35 @@ require 'spec_helper'
|
|
2
2
|
require 'logger'
|
3
3
|
|
4
4
|
describe "backwards compatible level" do
|
5
|
-
|
6
|
-
let(:level) { Yell::Level.new(:error) }
|
7
5
|
let(:logger) { Logger.new($stdout) }
|
8
6
|
|
9
7
|
before do
|
10
8
|
logger.level = level
|
11
9
|
end
|
12
10
|
|
13
|
-
|
14
|
-
|
11
|
+
context "with a Yell::Level instance" do
|
12
|
+
let(:level) { Yell::Level.new(:error) }
|
13
|
+
|
14
|
+
it "should format out the level correctly" do
|
15
|
+
expect(logger.level).to eq(level.to_i)
|
16
|
+
end
|
15
17
|
end
|
16
18
|
|
17
|
-
|
19
|
+
context "with a symbol", :pending => (RUBY_VERSION < "2.3") do
|
20
|
+
let(:level) { :error }
|
21
|
+
|
22
|
+
it "should format out the level correctly" do
|
23
|
+
expect(logger.level).to eq(3)
|
24
|
+
end
|
25
|
+
end
|
18
26
|
|
27
|
+
context "with an integer" do
|
28
|
+
let(:level) { 2 }
|
29
|
+
|
30
|
+
it "should format out the level correctly" do
|
31
|
+
expect(logger.level).to eq(2)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
|
36
|
+
end
|
data/spec/yell/formatter_spec.rb
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
require 'spec_helper'
|
4
4
|
|
5
5
|
describe Yell::Formatter do
|
6
|
-
let(:logger) { Yell::Logger.new(:stdout, :
|
6
|
+
let(:logger) { Yell::Logger.new(:stdout, name: 'Yell') }
|
7
7
|
let(:message) { "Hello World!" }
|
8
8
|
let(:event) { Yell::Event.new(logger, 1, message) }
|
9
9
|
let(:time) { Time.now }
|
@@ -180,7 +180,7 @@ describe Yell::Formatter do
|
|
180
180
|
end
|
181
181
|
|
182
182
|
describe "Hash" do
|
183
|
-
let(:message) { {:
|
183
|
+
let(:message) { {test: 'message'} }
|
184
184
|
|
185
185
|
it "Returns correctly" do
|
186
186
|
expect(output).to eq("test: message\n")
|
data/spec/yell/level_spec.rb
CHANGED
@@ -143,7 +143,7 @@ describe Yell::Level do
|
|
143
143
|
end
|
144
144
|
|
145
145
|
context "given an Array" do
|
146
|
-
let(:level) { Yell::Level.new( [
|
146
|
+
let(:level) { Yell::Level.new( %i[debug warn fatal] ) }
|
147
147
|
|
148
148
|
it "should return correctly" do
|
149
149
|
expect(level.at?(:debug)).to be_truthy
|
data/spec/yell/logger_spec.rb
CHANGED
@@ -71,7 +71,7 @@ describe Yell::Logger do
|
|
71
71
|
|
72
72
|
describe "initialize with #name" do
|
73
73
|
let(:name) { 'test' }
|
74
|
-
let!(:logger) { Yell.new(:
|
74
|
+
let!(:logger) { Yell.new(name: name) }
|
75
75
|
|
76
76
|
it "should set the name correctly" do
|
77
77
|
expect(logger.name).to eq(name)
|
@@ -84,7 +84,7 @@ describe Yell::Logger do
|
|
84
84
|
|
85
85
|
context "initialize with #level" do
|
86
86
|
let(:level) { :error }
|
87
|
-
let(:logger) { Yell.new(:
|
87
|
+
let(:logger) { Yell.new(level: level) }
|
88
88
|
subject { logger.level }
|
89
89
|
|
90
90
|
it { should be_instance_of(Yell::Level) }
|
@@ -93,7 +93,7 @@ describe Yell::Logger do
|
|
93
93
|
|
94
94
|
context "initialize with #trace" do
|
95
95
|
let(:trace) { :info }
|
96
|
-
let(:logger) { Yell.new(:
|
96
|
+
let(:logger) { Yell.new(trace: trace) }
|
97
97
|
subject { logger.trace }
|
98
98
|
|
99
99
|
it { should be_instance_of(Yell::Level) }
|
@@ -102,7 +102,7 @@ describe Yell::Logger do
|
|
102
102
|
|
103
103
|
context "initialize with #silence" do
|
104
104
|
let(:silence) { "test" }
|
105
|
-
let(:logger) { Yell.new(:
|
105
|
+
let(:logger) { Yell.new(silence: silence) }
|
106
106
|
subject { logger.silencer }
|
107
107
|
|
108
108
|
it { should be_instance_of(Yell::Silencer) }
|
@@ -112,7 +112,7 @@ describe Yell::Logger do
|
|
112
112
|
context "initialize with a #filename" do
|
113
113
|
it "should call adapter with :file" do
|
114
114
|
expect(Yell::Adapters::File).to(
|
115
|
-
receive(:new).with(:
|
115
|
+
receive(:new).with(filename: filename).and_call_original
|
116
116
|
)
|
117
117
|
|
118
118
|
Yell::Logger.new(filename)
|
@@ -124,7 +124,7 @@ describe Yell::Logger do
|
|
124
124
|
|
125
125
|
it "should call adapter with :file" do
|
126
126
|
expect(Yell::Adapters::File).to(
|
127
|
-
receive(:new).with(:
|
127
|
+
receive(:new).with(filename: pathname).and_call_original
|
128
128
|
)
|
129
129
|
|
130
130
|
Yell::Logger.new(pathname)
|
@@ -165,7 +165,7 @@ describe Yell::Logger do
|
|
165
165
|
|
166
166
|
context "with arity" do
|
167
167
|
let(:logger) do
|
168
|
-
Yell::Logger.new(:
|
168
|
+
Yell::Logger.new(level: level) { |l| l.adapter(:stdout) }
|
169
169
|
end
|
170
170
|
|
171
171
|
it "should pass the level correctly" do
|
@@ -179,7 +179,7 @@ describe Yell::Logger do
|
|
179
179
|
|
180
180
|
context "without arity" do
|
181
181
|
let(:logger) do
|
182
|
-
Yell::Logger.new(:
|
182
|
+
Yell::Logger.new(level: level) { adapter(:stdout) }
|
183
183
|
end
|
184
184
|
|
185
185
|
it "should pass the level correctly" do
|
@@ -200,22 +200,22 @@ describe Yell::Logger do
|
|
200
200
|
)
|
201
201
|
expect(Yell::Adapters::Stderr).to(
|
202
202
|
receive(:new).
|
203
|
-
with(hash_including(:
|
203
|
+
with(hash_including(level: :error)).
|
204
204
|
and_call_original
|
205
205
|
)
|
206
206
|
|
207
207
|
Yell::Logger.new(
|
208
|
-
:
|
208
|
+
adapters: [
|
209
209
|
:stdout,
|
210
|
-
{:
|
210
|
+
{stderr: {level: :error}}
|
211
211
|
]
|
212
212
|
)
|
213
213
|
end
|
214
214
|
end
|
215
215
|
|
216
216
|
context "caller's :file, :line and :method" do
|
217
|
-
let(:stdout) { Yell::Adapters::Stdout.new(:
|
218
|
-
let(:logger) { Yell::Logger.new(:
|
217
|
+
let(:stdout) { Yell::Adapters::Stdout.new(format: "%F, %n: %M") }
|
218
|
+
let(:logger) { Yell::Logger.new(trace: true) { |l| l.adapter(stdout) } }
|
219
219
|
|
220
220
|
it "should write correctly" do
|
221
221
|
factory = LoggerFactory.new
|
@@ -234,7 +234,7 @@ describe Yell::Logger do
|
|
234
234
|
end
|
235
235
|
|
236
236
|
context "logging in general" do
|
237
|
-
let(:logger) { Yell::Logger.new(filename, :
|
237
|
+
let(:logger) { Yell::Logger.new(filename, format: "%m") }
|
238
238
|
let(:line) { File.open(filename, &:readline) }
|
239
239
|
|
240
240
|
it "should output a single message" do
|
@@ -244,19 +244,19 @@ describe Yell::Logger do
|
|
244
244
|
end
|
245
245
|
|
246
246
|
it "should output multiple messages" do
|
247
|
-
logger.info ["Hello", "W", "o", "r", "l", "d"]
|
248
|
-
|
247
|
+
# logger.info ["Hello", "W", "o", "r", "l", "d"]
|
248
|
+
logger.info %w[Hello W o r l d]
|
249
249
|
expect(line).to eq("Hello W o r l d\n")
|
250
250
|
end
|
251
251
|
|
252
252
|
it "should output a hash and message" do
|
253
|
-
logger.info ["Hello World", {:
|
253
|
+
logger.info ["Hello World", {test: :message}]
|
254
254
|
|
255
255
|
expect(line).to eq("Hello World test: message\n")
|
256
256
|
end
|
257
257
|
|
258
258
|
it "should output a hash and message" do
|
259
|
-
logger.info [{:
|
259
|
+
logger.info [{test: :message}, "Hello World"]
|
260
260
|
|
261
261
|
expect(line).to eq("test: message Hello World\n")
|
262
262
|
end
|
@@ -271,7 +271,7 @@ describe Yell::Logger do
|
|
271
271
|
context "logging with a silencer" do
|
272
272
|
let(:silence) { "this" }
|
273
273
|
let(:stdout) { Yell::Adapters::Stdout.new }
|
274
|
-
let(:logger) { Yell::Logger.new(stdout, :
|
274
|
+
let(:logger) { Yell::Logger.new(stdout, silence: silence) }
|
275
275
|
|
276
276
|
it "should not pass a matching message to any adapter" do
|
277
277
|
expect(stdout).to_not receive(:write)
|
@@ -12,7 +12,7 @@ describe Yell::Repository do
|
|
12
12
|
end
|
13
13
|
|
14
14
|
context "when logger with :name exists" do
|
15
|
-
let!(:logger) { Yell.new(:stdout, :
|
15
|
+
let!(:logger) { Yell.new(:stdout, name: name) }
|
16
16
|
|
17
17
|
it "should eq(logger)" do
|
18
18
|
expect(subject).to eq(logger)
|
@@ -20,7 +20,7 @@ describe Yell::Repository do
|
|
20
20
|
end
|
21
21
|
|
22
22
|
context "given a Class" do
|
23
|
-
let!(:logger) { Yell.new(:stdout, :
|
23
|
+
let!(:logger) { Yell.new(:stdout, name: "Numeric") }
|
24
24
|
|
25
25
|
it "should raise with the correct :name when logger not found" do
|
26
26
|
expect(Yell::LoggerNotFound).to(
|
@@ -50,7 +50,7 @@ describe Yell::Repository do
|
|
50
50
|
end
|
51
51
|
|
52
52
|
context ".[]= with a named logger" do
|
53
|
-
let!(:logger) { Yell.new(:stdout, :
|
53
|
+
let!(:logger) { Yell.new(:stdout, name: name) }
|
54
54
|
before { Yell::Repository[name] = logger }
|
55
55
|
|
56
56
|
it "should eq(logger)" do
|
@@ -60,7 +60,7 @@ describe Yell::Repository do
|
|
60
60
|
|
61
61
|
context ".[]= with a named logger of a different name" do
|
62
62
|
let(:other) { 'other' }
|
63
|
-
let(:logger) { Yell.new(:stdout, :
|
63
|
+
let(:logger) { Yell.new(:stdout, name: other) }
|
64
64
|
before { Yell::Repository[name] = logger }
|
65
65
|
|
66
66
|
it "should add logger to both repositories" do
|
data/yell.gemspec
CHANGED
@@ -12,8 +12,17 @@ Gem::Specification.new do |spec|
|
|
12
12
|
spec.homepage = "http://rudionrailspec.github.com/yell"
|
13
13
|
spec.summary = %q{Yell - Your Extensible Logging Library}
|
14
14
|
spec.description = %q{Yell - Your Extensible Logging Library. Define multiple adapters, various log level combinations or message formatting options like you've never done before}
|
15
|
-
|
16
|
-
|
15
|
+
if spec.respond_to?(:metadata)
|
16
|
+
# metadata keys must be strings, not symbols
|
17
|
+
spec.metadata = {
|
18
|
+
'github_repo' => 'https://github.com/rudionrails/yell',
|
19
|
+
'bug_tracker_uri' => 'https://github.com/rudionrails/yell/issues',
|
20
|
+
'documentation_uri' => 'http://rudionrailspec.github.com/yell',
|
21
|
+
'homepage_uri' => 'http://rudionrailspec.github.com/yell',
|
22
|
+
'source_code_uri' => 'https://github.com/rudionrails/yell',
|
23
|
+
'wiki_uri' => 'http://rudionrailspec.github.com/yell'
|
24
|
+
}
|
25
|
+
end
|
17
26
|
|
18
27
|
spec.files = `git ls-files -z`.split("\x0")
|
19
28
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yell
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rudolf Schmidt
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-05-19 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Yell - Your Extensible Logging Library. Define multiple adapters, various
|
14
14
|
log level combinations or message formatting options like you've never done before
|
@@ -21,8 +21,6 @@ files:
|
|
21
21
|
- ".ruby-version"
|
22
22
|
- ".travis.yml"
|
23
23
|
- Gemfile
|
24
|
-
- Gemfile.lte-1.9.3
|
25
|
-
- Gemfile.lte-2.2.2
|
26
24
|
- LICENSE.txt
|
27
25
|
- README.md
|
28
26
|
- Rakefile
|
@@ -87,7 +85,13 @@ files:
|
|
87
85
|
homepage: http://rudionrailspec.github.com/yell
|
88
86
|
licenses:
|
89
87
|
- MIT
|
90
|
-
metadata:
|
88
|
+
metadata:
|
89
|
+
github_repo: https://github.com/rudionrails/yell
|
90
|
+
bug_tracker_uri: https://github.com/rudionrails/yell/issues
|
91
|
+
documentation_uri: http://rudionrailspec.github.com/yell
|
92
|
+
homepage_uri: http://rudionrailspec.github.com/yell
|
93
|
+
source_code_uri: https://github.com/rudionrails/yell
|
94
|
+
wiki_uri: http://rudionrailspec.github.com/yell
|
91
95
|
post_install_message:
|
92
96
|
rdoc_options: []
|
93
97
|
require_paths:
|
@@ -103,7 +107,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
103
107
|
- !ruby/object:Gem::Version
|
104
108
|
version: '0'
|
105
109
|
requirements: []
|
106
|
-
rubyforge_project:
|
110
|
+
rubyforge_project:
|
107
111
|
rubygems_version: 2.6.11
|
108
112
|
signing_key:
|
109
113
|
specification_version: 4
|
data/Gemfile.lte-1.9.3
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
source "http://rubygems.org"
|
2
|
-
|
3
|
-
# Specify your gem's dependencies in yell.gemspec
|
4
|
-
gemspec
|
5
|
-
|
6
|
-
group :development, :test do
|
7
|
-
gem 'rake'
|
8
|
-
|
9
|
-
gem 'rspec-core', '~> 3'
|
10
|
-
gem 'rspec-expectations'
|
11
|
-
gem 'rspec-mocks'
|
12
|
-
gem 'rspec-its'
|
13
|
-
|
14
|
-
gem 'timecop', '~> 0.8'
|
15
|
-
|
16
|
-
gem 'activesupport', '~> 3'
|
17
|
-
end
|
data/Gemfile.lte-2.2.2
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
source "http://rubygems.org"
|
2
|
-
|
3
|
-
# Specify your gem's dependencies in yell.gemspec
|
4
|
-
gemspec
|
5
|
-
|
6
|
-
group :development, :test do
|
7
|
-
gem "rake"
|
8
|
-
|
9
|
-
gem 'rspec-core', '~> 3'
|
10
|
-
gem 'rspec-expectations'
|
11
|
-
gem 'rspec-mocks'
|
12
|
-
gem 'rspec-its'
|
13
|
-
|
14
|
-
gem 'timecop', '~> 0.8'
|
15
|
-
|
16
|
-
gem 'activesupport', '~> 4'
|
17
|
-
end
|