TwP-logging 1.1.2 → 1.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +5 -0
- data/examples/appenders.rb +3 -0
- data/examples/classes.rb +2 -0
- data/examples/consolidation.rb +2 -0
- data/examples/formatting.rb +2 -0
- data/examples/hierarchies.rb +2 -0
- data/examples/layouts.rb +3 -0
- data/examples/loggers.rb +3 -0
- data/examples/names.rb +3 -0
- data/examples/simple.rb +3 -0
- data/lib/logging.rb +1 -1
- data/lib/logging/config/configurator.rb +3 -5
- metadata +2 -2
data/History.txt
CHANGED
data/examples/appenders.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# :stopdoc:
|
1
2
|
#
|
2
3
|
# Appenders are used to output log events to some logging destination. The
|
3
4
|
# same log event can be sent to multiple desitnations by associating
|
@@ -42,3 +43,5 @@
|
|
42
43
|
# These messages will be logged to both the log file and to STDOUT
|
43
44
|
log.debug "a very nice little debug message"
|
44
45
|
log.warn "this is your last warning"
|
46
|
+
|
47
|
+
# :startdoc:
|
data/examples/classes.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# :stopdoc:
|
1
2
|
#
|
2
3
|
# The Logging framework is very good about figuring out predictable names
|
3
4
|
# for loggers regardless of what object is used to create them. The name is
|
@@ -37,3 +38,4 @@
|
|
37
38
|
foo.info 'this message came from Foo'
|
38
39
|
bar.warn 'this is a warning from Foo::Bar'
|
39
40
|
|
41
|
+
# :startdoc:
|
data/examples/consolidation.rb
CHANGED
data/examples/formatting.rb
CHANGED
data/examples/hierarchies.rb
CHANGED
data/examples/layouts.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# :stopdoc:
|
1
2
|
#
|
2
3
|
# The formatting of log messages is controlled by the layout given to the
|
3
4
|
# appender. By default all appenders use the Basic layout. It's pretty
|
@@ -43,3 +44,5 @@
|
|
43
44
|
log.warn "this is your last warning"
|
44
45
|
log.error StandardError.new("something went horribly wrong")
|
45
46
|
log.fatal "I Die!"
|
47
|
+
|
48
|
+
# :startdoc:
|
data/examples/loggers.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# :stopdoc:
|
1
2
|
#
|
2
3
|
# Multiple loggers can be created and each can be configured with it's own
|
3
4
|
# log level and appenders. So one logger can be configured to output debug
|
@@ -24,3 +25,5 @@
|
|
24
25
|
log1.info "this message will not get logged"
|
25
26
|
log2.info "nor will this message"
|
26
27
|
log3.info "but this message will get logged"
|
28
|
+
|
29
|
+
# :startdoc:
|
data/examples/names.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# :stopdoc:
|
1
2
|
#
|
2
3
|
# Loggers and appenders can be looked up by name. The bracket notation is
|
3
4
|
# used to find these objects:
|
@@ -38,3 +39,5 @@
|
|
38
39
|
# and now log some messages
|
39
40
|
Logging.logger['Critical'].info 'just keeping you informed'
|
40
41
|
Logging.logger['Critical'].fatal 'WTF!!'
|
42
|
+
|
43
|
+
# :startdoc:
|
data/examples/simple.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# :stopdoc:
|
1
2
|
#
|
2
3
|
# Logging provides a simple, default logger configured in the same manner as
|
3
4
|
# the default Ruby Logger class -- i.e. the output of the two will be the
|
@@ -12,3 +13,5 @@
|
|
12
13
|
|
13
14
|
log.debug "this debug message will not be output by the logger"
|
14
15
|
log.warn "this is your last warning"
|
16
|
+
|
17
|
+
# :startdoc:
|
data/lib/logging.rb
CHANGED
@@ -26,7 +26,7 @@ module Logging::Config
|
|
26
26
|
raise Error, "missing configuration block" unless block
|
27
27
|
|
28
28
|
dsl = TopLevelDSL.new
|
29
|
-
dsl.
|
29
|
+
dsl.instance_eval(&block)
|
30
30
|
|
31
31
|
pre_config dsl.__pre_config
|
32
32
|
::Logging::Logger[:root] # ensures the log levels are defined
|
@@ -130,15 +130,13 @@ module Logging::Config
|
|
130
130
|
end
|
131
131
|
|
132
132
|
class DSL
|
133
|
-
alias :__instance_eval :instance_eval
|
134
|
-
|
135
133
|
instance_methods.each do |m|
|
136
|
-
undef_method m unless m[%r/^(__|object_id)/]
|
134
|
+
undef_method m unless m[%r/^(__|object_id|instance_eval)/]
|
137
135
|
end
|
138
136
|
|
139
137
|
def self.process( &block )
|
140
138
|
dsl = new
|
141
|
-
dsl.
|
139
|
+
dsl.instance_eval(&block)
|
142
140
|
dsl.__hash
|
143
141
|
end
|
144
142
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: TwP-logging
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tim Pease
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-05-
|
12
|
+
date: 2009-05-13 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|