GitHub Sale: sign up for any paid plan this week and pay nothing until January 1, 2009!  [ hide ]

public
Description: A flexible logging library for use in Ruby programs based on the design of Java's log4j library.
Homepage: http://logging.rubyforge.org/
Clone URL: git://github.com/TwP/logging.git
Settled on a DSL for configuring the Logging gem. This code works but 
needs some commenting love (and tests).
Tim Pease (author)
Wed Jul 16 10:25:56 -0700 2008
commit  000c1bfcc2c7d6ea9b6cd72906ac6dbe3d607016
tree    020c19bf2c36a355499855c8ea70579da1da8858
parent  12d44954ca61dd547672c53b32700dea38ff0f7f
...
3
4
5
 
6
7
8
...
3
4
5
6
7
8
9
0
@@ -3,6 +3,7 @@
0
 2 minor enhancement
0
   - Exceptions from appenders are captured and logged
0
   - Internal logger for the Logging framework (disabled by default)
0
+ - Added a DSL configuration format (more readable than YAML)
0
 1 bug fix
0
   - Modules could not have their own logger instance
0
 
...
2
3
4
 
5
6
7
...
12
13
14
 
15
16
17
...
2
3
4
5
6
7
8
...
13
14
15
16
17
18
19
0
@@ -2,6 +2,7 @@ History.txt
0
 Manifest.txt
0
 README.txt
0
 Rakefile
0
+data/logging.rb
0
 data/logging.yaml
0
 lib/logging.rb
0
 lib/logging/appender.rb
0
@@ -12,6 +13,7 @@ lib/logging/appenders/growl.rb
0
 lib/logging/appenders/io.rb
0
 lib/logging/appenders/rolling_file.rb
0
 lib/logging/appenders/syslog.rb
0
+lib/logging/config/configurator.rb
0
 lib/logging/config/yaml_configurator.rb
0
 lib/logging/layout.rb
0
 lib/logging/layouts/basic.rb
...
22
23
24
 
25
26
27
28
29
30
 
 
 
 
 
 
 
 
31
32
33
...
22
23
24
25
26
27
28
29
30
 
31
32
33
34
35
36
37
38
39
40
41
0
@@ -22,12 +22,20 @@ module Logging
0
 
0
     # call-seq:
0
     # Logging.configure( filename )
0
+ # Logging.configure { block }
0
     #
0
     # Configures the Logging framework using the configuration information
0
     # found in the given file. The file extension should be either '.yaml'
0
     # or '.yml' (XML configuration is not yet supported).
0
     #
0
- def configure( filename, *args )
0
+ def configure( *args, &block )
0
+ if block
0
+ return ::Logging::Config::Configurator.process(&block)
0
+ end
0
+
0
+ filename = args.shift
0
+ raise ArgumentError, 'a filename was not given' if filename.nil?
0
+
0
       case File.extname(filename)
0
       when '.yaml', '.yml'
0
         ::Logging::Config::YamlConfigurator.load(filename, *args)
...
161
162
163
 
164
165
166
167
168
...
161
162
163
164
165
 
166
167
168
0
@@ -161,8 +161,8 @@ module Logging
0
     #
0
     def to_key( key )
0
       case key
0
+ when :root, 'root'; :root
0
       when String; key
0
- when :root; key
0
       when Symbol; key.to_s
0
       when Module; key.name
0
       when Object; key.class.name

Comments

    No one has commented yet.