log4r-color 1.1.11 → 1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/examples/color_output.rb +5 -2
- data/examples/customlevels.rb +2 -2
- data/examples/gmail.rb +4 -4
- data/examples/logclient.rb +2 -2
- data/examples/logserver.rb +2 -2
- data/examples/rrsetup.rb +2 -2
- data/examples/syslogcustom.rb +4 -4
- data/examples/xmlconfig.rb +2 -2
- data/examples/yaml.rb +5 -5
- data/lib/{log4r → log4r-color}/GDC.rb +1 -1
- data/lib/{log4r → log4r-color}/MDC.rb +1 -1
- data/lib/{log4r → log4r-color}/NDC.rb +1 -1
- data/lib/{log4r → log4r-color}/base.rb +3 -3
- data/lib/{log4r → log4r-color}/config.rb +0 -0
- data/lib/{log4r → log4r-color}/configurator.rb +6 -6
- data/lib/{log4r → log4r-color}/formatter/formatter.rb +1 -1
- data/lib/{log4r → log4r-color}/formatter/log4jxmlformatter.rb +1 -1
- data/lib/{log4r → log4r-color}/formatter/patternformatter.rb +5 -5
- data/lib/{log4r → log4r-color}/lib/drbloader.rb +0 -0
- data/lib/{log4r → log4r-color}/lib/xmlloader.rb +0 -0
- data/lib/{log4r → log4r-color}/logevent.rb +0 -0
- data/lib/{log4r → log4r-color}/logger.rb +5 -5
- data/lib/{log4r → log4r-color}/loggerfactory.rb +3 -3
- data/lib/{log4r → log4r-color}/logserver.rb +3 -3
- data/lib/{log4r → log4r-color}/outputter/consoleoutputters.rb +4 -1
- data/lib/{log4r → log4r-color}/outputter/datefileoutputter.rb +2 -2
- data/lib/{log4r → log4r-color}/outputter/emailoutputter.rb +2 -2
- data/lib/{log4r → log4r-color}/outputter/fileoutputter.rb +2 -2
- data/lib/{log4r → log4r-color}/outputter/iooutputter.rb +2 -2
- data/lib/{log4r → log4r-color}/outputter/outputter.rb +3 -3
- data/lib/{log4r → log4r-color}/outputter/outputterfactory.rb +3 -3
- data/lib/{log4r → log4r-color}/outputter/remoteoutputter.rb +3 -3
- data/lib/{log4r → log4r-color}/outputter/rollingfileoutputter.rb +2 -2
- data/lib/{log4r → log4r-color}/outputter/scribeoutputter.rb +1 -1
- data/lib/{log4r → log4r-color}/outputter/staticoutputter.rb +0 -0
- data/lib/{log4r → log4r-color}/outputter/syslogoutputter.rb +3 -3
- data/lib/{log4r → log4r-color}/outputter/udpoutputter.rb +2 -2
- data/lib/{log4r → log4r-color}/rdoc/GDC +0 -0
- data/lib/{log4r → log4r-color}/rdoc/MDC +0 -0
- data/lib/{log4r → log4r-color}/rdoc/NDC +0 -0
- data/lib/{log4r → log4r-color}/rdoc/configurator +2 -2
- data/lib/{log4r → log4r-color}/rdoc/emailoutputter +2 -2
- data/lib/{log4r → log4r-color}/rdoc/formatter +3 -3
- data/lib/{log4r → log4r-color}/rdoc/log4r +6 -6
- data/lib/{log4r → log4r-color}/rdoc/logger +2 -2
- data/lib/{log4r → log4r-color}/rdoc/logserver +2 -2
- data/lib/{log4r → log4r-color}/rdoc/outputter +4 -4
- data/lib/{log4r → log4r-color}/rdoc/patternformatter +1 -1
- data/lib/{log4r → log4r-color}/rdoc/scribeoutputter +0 -0
- data/lib/{log4r → log4r-color}/rdoc/syslogoutputter +2 -2
- data/lib/{log4r → log4r-color}/rdoc/win32eventoutputter +0 -0
- data/lib/{log4r → log4r-color}/rdoc/yamlconfigurator +1 -1
- data/lib/{log4r → log4r-color}/repository.rb +1 -1
- data/lib/{log4r → log4r-color}/staticlogger.rb +0 -0
- data/lib/{log4r → log4r-color}/yamlconfigurator.rb +5 -5
- data/lib/log4r-color.rb +20 -0
- data/tests/testchainsaw.rb +4 -4
- metadata +49 -50
- data/lib/log4r.rb +0 -20
data/Rakefile
CHANGED
@@ -10,7 +10,7 @@ require 'date'
|
|
10
10
|
require 'fileutils'
|
11
11
|
|
12
12
|
GEM = "log4r-color"
|
13
|
-
GEM_VERSION = "1.
|
13
|
+
GEM_VERSION = "1.2"
|
14
14
|
AUTHORS = "Colby Gutierrez-Kraybill, Kristian Mandrup (color outputter)"
|
15
15
|
EMAIL = "colby@astro.berkeley.edu, kmandrup@gmail.com"
|
16
16
|
HOMEPAGE = %q{http://log4r.rubyforge.org}
|
data/examples/color_output.rb
CHANGED
@@ -2,13 +2,13 @@ $: << File.join("..","lib")
|
|
2
2
|
|
3
3
|
require 'rubygems'
|
4
4
|
|
5
|
-
require 'log4r'
|
5
|
+
require 'log4r-color'
|
6
6
|
include Log4r
|
7
7
|
|
8
8
|
Logger.global.level = ALL
|
9
9
|
formatter = PatternFormatter.new(:pattern => "%l - %m - %c")
|
10
10
|
|
11
|
-
ColorOutputter.new 'color', {:colors => {:info => {:color => :light_blue, :background => :
|
11
|
+
ColorOutputter.new 'color', {:colors => {:debug => :light_blue, :info => {:color => :light_blue, :background => :white}, :warn => :yellow, :error => :red, :fatal => {:color => :red, :background => :white} } }
|
12
12
|
|
13
13
|
Logger.new('color_logger', DEBUG).add('color')
|
14
14
|
|
@@ -18,8 +18,11 @@ def do_logging(log)
|
|
18
18
|
log.debug "This is debug"
|
19
19
|
log.info "This is info"
|
20
20
|
log.warn "This is warn"
|
21
|
+
Outputter['color'].colors[:info] = :green
|
22
|
+
log.info "This is info again"
|
21
23
|
log.error "This is error"
|
22
24
|
log.fatal "This is fatal"
|
25
|
+
|
23
26
|
end
|
24
27
|
|
25
28
|
# This logger is configured to log at FATAL, and it does
|
data/examples/customlevels.rb
CHANGED
data/examples/gmail.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
# Log4r can be configured using YAML to email using STARTTLS. This example uses gmail.yaml
|
2
2
|
|
3
3
|
$: << File.join('..','lib') # path if log4r is not installed
|
4
|
-
require 'log4r'
|
5
|
-
require 'log4r/yamlconfigurator'
|
4
|
+
require 'log4r-color'
|
5
|
+
require 'log4r-color/yamlconfigurator'
|
6
6
|
# we use various outputters, so require them, otherwise config chokes
|
7
|
-
require 'log4r/outputter/datefileoutputter'
|
8
|
-
require 'log4r/outputter/emailoutputter'
|
7
|
+
require 'log4r-color/outputter/datefileoutputter'
|
8
|
+
require 'log4r-color/outputter/emailoutputter'
|
9
9
|
include Log4r
|
10
10
|
|
11
11
|
cfg = YamlConfigurator # shorthand
|
data/examples/logclient.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# How to use RemoteOutputter. See logserver.rb first.
|
2
2
|
|
3
3
|
$: << File.join('..','lib')
|
4
|
-
require 'log4r'
|
5
|
-
require 'log4r/outputter/remoteoutputter'
|
4
|
+
require 'log4r-color'
|
5
|
+
require 'log4r-color/outputter/remoteoutputter'
|
6
6
|
include Log4r
|
7
7
|
|
8
8
|
Logger.new('log4r').add 'stdout' # to see what's going on inside
|
data/examples/logserver.rb
CHANGED
data/examples/rrsetup.rb
CHANGED
data/examples/syslogcustom.rb
CHANGED
@@ -8,10 +8,10 @@
|
|
8
8
|
|
9
9
|
$: << '../lib'
|
10
10
|
|
11
|
-
require 'log4r'
|
12
|
-
require 'log4r/configurator'
|
13
|
-
require 'log4r/formatter/patternformatter'
|
14
|
-
require 'log4r/outputter/syslogoutputter'
|
11
|
+
require 'log4r-color'
|
12
|
+
require 'log4r-color/configurator'
|
13
|
+
require 'log4r-color/formatter/patternformatter'
|
14
|
+
require 'log4r-color/outputter/syslogoutputter'
|
15
15
|
require 'syslog'
|
16
16
|
include Log4r
|
17
17
|
include Syslog::Constants
|
data/examples/xmlconfig.rb
CHANGED
data/examples/yaml.rb
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
# Log4r can be configured using YAML. This example uses log4r_yaml.yaml
|
2
2
|
|
3
3
|
$: << File.join('..','lib') # path if log4r is not installed
|
4
|
-
require 'log4r'
|
5
|
-
require 'log4r/yamlconfigurator'
|
4
|
+
require 'log4r-color'
|
5
|
+
require 'log4r-color/yamlconfigurator'
|
6
6
|
# we use various outputters, so require them, otherwise config chokes
|
7
|
-
require 'log4r/outputter/datefileoutputter'
|
8
|
-
require 'log4r/outputter/emailoutputter'
|
9
|
-
require 'log4r/outputter/scribeoutputter'
|
7
|
+
require 'log4r-color/outputter/datefileoutputter'
|
8
|
+
require 'log4r-color/outputter/emailoutputter'
|
9
|
+
require 'log4r-color/outputter/scribeoutputter'
|
10
10
|
|
11
11
|
cfg = Log4r::YamlConfigurator # shorthand
|
12
12
|
cfg['HOME'] = '.' # the only parameter in the YAML, our HOME directory
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# :nodoc:
|
2
|
-
require "log4r/config"
|
2
|
+
require "log4r-color/config"
|
3
3
|
|
4
4
|
module Log4r
|
5
5
|
ALL = 0
|
@@ -61,11 +61,11 @@ module Log4r
|
|
61
61
|
end
|
62
62
|
|
63
63
|
def self.level_key level
|
64
|
-
valid_levels[level]
|
64
|
+
valid_levels[level -1]
|
65
65
|
end
|
66
66
|
|
67
67
|
def self.valid_levels
|
68
|
-
[:debug, :info, :
|
68
|
+
[:debug, :info, :warn, :error, :fatal]
|
69
69
|
end
|
70
70
|
|
71
71
|
# Shortcut for decoding 'true', 'false', true, false or nil into a bool
|
File without changes
|
@@ -4,11 +4,11 @@
|
|
4
4
|
#
|
5
5
|
# Version:: $Id$
|
6
6
|
|
7
|
-
require "log4r/logger"
|
8
|
-
require "log4r/outputter/staticoutputter"
|
9
|
-
require "log4r/lib/xmlloader"
|
10
|
-
require "log4r/logserver"
|
11
|
-
require "log4r/outputter/remoteoutputter"
|
7
|
+
require "log4r-color/logger"
|
8
|
+
require "log4r-color/outputter/staticoutputter"
|
9
|
+
require "log4r-color/lib/xmlloader"
|
10
|
+
require "log4r-color/logserver"
|
11
|
+
require "log4r-color/outputter/remoteoutputter"
|
12
12
|
|
13
13
|
# TODO: catch unparsed parameters #{FOO} and die
|
14
14
|
module Log4r
|
@@ -16,7 +16,7 @@ module Log4r
|
|
16
16
|
class ConfigError < Exception
|
17
17
|
end
|
18
18
|
|
19
|
-
# See log4r/configurator.rb
|
19
|
+
# See log4r-color/configurator.rb
|
20
20
|
class Configurator
|
21
21
|
include REXML if HAVE_REXML
|
22
22
|
@@params = Hash.new
|
@@ -4,13 +4,13 @@
|
|
4
4
|
#
|
5
5
|
# Version:: $Id$
|
6
6
|
|
7
|
-
require "log4r/formatter/formatter"
|
8
|
-
require "log4r/GDC"
|
9
|
-
require "log4r/MDC"
|
10
|
-
require "log4r/NDC"
|
7
|
+
require "log4r-color/formatter/formatter"
|
8
|
+
require "log4r-color/GDC"
|
9
|
+
require "log4r-color/MDC"
|
10
|
+
require "log4r-color/NDC"
|
11
11
|
|
12
12
|
module Log4r
|
13
|
-
# See log4r/formatter/patternformatter.rb
|
13
|
+
# See log4r-color/formatter/patternformatter.rb
|
14
14
|
class PatternFormatter < BasicFormatter
|
15
15
|
|
16
16
|
# Arguments to sprintf keyed to directive letters<br>
|
File without changes
|
File without changes
|
File without changes
|
@@ -5,14 +5,14 @@
|
|
5
5
|
# Version:: $Id$
|
6
6
|
# Author:: Leon Torres <leon(at)ugcs.caltech.edu>
|
7
7
|
|
8
|
-
require "log4r/outputter/outputter"
|
9
|
-
require "log4r/repository"
|
10
|
-
require "log4r/loggerfactory"
|
11
|
-
require "log4r/staticlogger"
|
8
|
+
require "log4r-color/outputter/outputter"
|
9
|
+
require "log4r-color/repository"
|
10
|
+
require "log4r-color/loggerfactory"
|
11
|
+
require "log4r-color/staticlogger"
|
12
12
|
|
13
13
|
module Log4r
|
14
14
|
|
15
|
-
# See log4r/logger.rb
|
15
|
+
# See log4r-color/logger.rb
|
16
16
|
class Logger
|
17
17
|
attr_reader :name, :fullname, :path, :level, :parent
|
18
18
|
attr_reader :additive, :trace, :outputters
|
@@ -1,10 +1,10 @@
|
|
1
1
|
# :include: rdoc/logserver
|
2
2
|
|
3
|
-
require 'log4r/logger'
|
4
|
-
require 'log4r/lib/drbloader'
|
3
|
+
require 'log4r-color/logger'
|
4
|
+
require 'log4r-color/lib/drbloader'
|
5
5
|
|
6
6
|
module Log4r
|
7
|
-
# See log4r/logserver.rb
|
7
|
+
# See log4r-color/logserver.rb
|
8
8
|
class LogServer < Logger
|
9
9
|
attr_reader :uri
|
10
10
|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# :nodoc:
|
2
|
-
require "log4r/outputter/iooutputter"
|
2
|
+
require "log4r-color/outputter/iooutputter"
|
3
3
|
require "colorize"
|
4
4
|
|
5
5
|
module Log4r
|
@@ -32,6 +32,9 @@ module Log4r
|
|
32
32
|
def write(data, lv)
|
33
33
|
begin
|
34
34
|
key = level_key(lv)
|
35
|
+
# puts "color key: #{key}, lv: #{lv}"
|
36
|
+
# puts "colors: #{colors}"
|
37
|
+
# puts "colors on key: #{colors[key]}"
|
35
38
|
@out.print data.colorize(colors[key])
|
36
39
|
@out.flush
|
37
40
|
@out.print "".uncolorize
|
@@ -31,8 +31,8 @@
|
|
31
31
|
# recorded as the smallest time interval equals the rollover period for this
|
32
32
|
# system.
|
33
33
|
|
34
|
-
require "log4r/outputter/fileoutputter"
|
35
|
-
require "log4r/staticlogger"
|
34
|
+
require "log4r-color/outputter/fileoutputter"
|
35
|
+
require "log4r-color/staticlogger"
|
36
36
|
|
37
37
|
module Log4r
|
38
38
|
|
@@ -7,9 +7,9 @@
|
|
7
7
|
|
8
8
|
require "thread"
|
9
9
|
|
10
|
-
require "log4r/outputter/outputterfactory"
|
11
|
-
require "log4r/formatter/formatter"
|
12
|
-
require "log4r/staticlogger"
|
10
|
+
require "log4r-color/outputter/outputterfactory"
|
11
|
+
require "log4r-color/formatter/formatter"
|
12
|
+
require "log4r-color/staticlogger"
|
13
13
|
|
14
14
|
require 'monitor'
|
15
15
|
|
@@ -1,9 +1,9 @@
|
|
1
1
|
# :nodoc:
|
2
|
-
require 'log4r/lib/drbloader'
|
3
|
-
require 'log4r/outputter/outputter'
|
2
|
+
require 'log4r-color/lib/drbloader'
|
3
|
+
require 'log4r-color/outputter/outputter'
|
4
4
|
|
5
5
|
module Log4r
|
6
|
-
# See log4r/logserver.rb
|
6
|
+
# See log4r-color/logserver.rb
|
7
7
|
class RemoteOutputter < Outputter
|
8
8
|
|
9
9
|
def initialize(_name, hash={})
|
@@ -2,8 +2,8 @@
|
|
2
2
|
# :nodoc:
|
3
3
|
# Version:: $Id: rollingfileoutputter.rb,v 1.2 2009/09/29 18:13:13 colbygk Exp $
|
4
4
|
|
5
|
-
require "log4r/outputter/fileoutputter"
|
6
|
-
require "log4r/staticlogger"
|
5
|
+
require "log4r-color/outputter/fileoutputter"
|
6
|
+
require "log4r-color/staticlogger"
|
7
7
|
|
8
8
|
require 'fileutils'
|
9
9
|
|
File without changes
|
@@ -4,9 +4,9 @@
|
|
4
4
|
# Author:: Steve Lumos
|
5
5
|
# Author:: Leon Torres
|
6
6
|
|
7
|
-
require 'log4r/formatter/formatter'
|
8
|
-
require 'log4r/outputter/outputter'
|
9
|
-
require 'log4r/configurator'
|
7
|
+
require 'log4r-color/formatter/formatter'
|
8
|
+
require 'log4r-color/outputter/outputter'
|
9
|
+
require 'log4r-color/configurator'
|
10
10
|
require 'syslog'
|
11
11
|
|
12
12
|
module Log4r
|
File without changes
|
File without changes
|
File without changes
|
@@ -7,14 +7,14 @@ customize the logging levels.
|
|
7
7
|
|
8
8
|
Log4r is also configurable using YAML. For that, there is
|
9
9
|
a class similar to Configurator called Log4r::YamlConfigurator. Please see
|
10
|
-
log4r/yamlconfigurator.rb for details.
|
10
|
+
log4r-color/yamlconfigurator.rb for details.
|
11
11
|
|
12
12
|
REXML is required for XML configuration. Get REXML at
|
13
13
|
http://www.ruby-lang.org/en/raa-list.rhtml?name=REXML
|
14
14
|
|
15
15
|
To use the Configurator class,
|
16
16
|
|
17
|
-
require 'log4r/configurator'
|
17
|
+
require 'log4r-color/configurator'
|
18
18
|
|
19
19
|
== Custom Levels
|
20
20
|
|
@@ -8,7 +8,7 @@ send email, it will set itself to OFF and stop logging.
|
|
8
8
|
|
9
9
|
In order to use it,
|
10
10
|
|
11
|
-
require 'log4r/outputter/emailoutputter'
|
11
|
+
require 'log4r-color/outputter/emailoutputter'
|
12
12
|
|
13
13
|
== SMTP Configuration
|
14
14
|
|
@@ -82,7 +82,7 @@ log events and sending immediates on CRIT and WARN
|
|
82
82
|
|
83
83
|
== XML Configuration
|
84
84
|
|
85
|
-
See log4r/configurator.rb for details. Here's an example:
|
85
|
+
See log4r-color/configurator.rb for details. Here's an example:
|
86
86
|
|
87
87
|
<outputter name="security" type="EmailOutputter"
|
88
88
|
buffsize="25" level="ALL">
|
@@ -7,7 +7,7 @@ Log4r::Formatter#format method prior to writing.
|
|
7
7
|
== Available Formatters
|
8
8
|
|
9
9
|
* Log4r::BasicFormatter - default
|
10
|
-
* Log4r::PatternFormatter - most flexible. See log4r/formatter/patternformatter.rb
|
10
|
+
* Log4r::PatternFormatter - most flexible. See log4r-color/formatter/patternformatter.rb
|
11
11
|
* Log4r::SimpleFormatter - like BasicFormatter for Strings only (low noise)
|
12
12
|
* Log4r::ObjectFormatter - for inspecting objects
|
13
13
|
* Log4r::NullFormatter - twirls on its feet and does nothing
|
@@ -21,7 +21,7 @@ Specify the Formatter and its class (as +type+) under an
|
|
21
21
|
<formatter type="Log4r::BasicFormatter"/>
|
22
22
|
</outputter>
|
23
23
|
|
24
|
-
As explained in log4r/configurator.rb, the hash arguments you would normally
|
24
|
+
As explained in log4r-color/configurator.rb, the hash arguments you would normally
|
25
25
|
pass to +new+ are specified as <i>XML parameters</i>. Only PatternFormatter
|
26
26
|
has any of these.
|
27
27
|
|
@@ -32,7 +32,7 @@ that extends Formatter and override the Formatter#format method.
|
|
32
32
|
Then give it to any interested Outputters.
|
33
33
|
|
34
34
|
If you're interested in setting up your custom formatters in XML,
|
35
|
-
please take a look at log4r/configurator.rb.
|
35
|
+
please take a look at log4r-color/configurator.rb.
|
36
36
|
|
37
37
|
== Data Available
|
38
38
|
|
@@ -41,7 +41,7 @@ You can have as many levels as you desire, with any naming scheme. Log4r
|
|
41
41
|
will automatically define level constants and log method names after
|
42
42
|
your custom specification.
|
43
43
|
|
44
|
-
Please see log4r/configurator.rb for details.
|
44
|
+
Please see log4r-color/configurator.rb for details.
|
45
45
|
|
46
46
|
=== Boundary Levels
|
47
47
|
|
@@ -56,10 +56,10 @@ whereas <tt>OFF</tt> will turn off logging completely.
|
|
56
56
|
|
57
57
|
== File Overviews
|
58
58
|
|
59
|
-
For Loggers:: log4r/logger.rb
|
60
|
-
For Outputters:: log4r/outputter/outputter.rb
|
61
|
-
For Formatters:: log4r/formatter/formatter.rb
|
62
|
-
For configuration:: log4r/configurator.rb
|
59
|
+
For Loggers:: log4r-color/logger.rb
|
60
|
+
For Outputters:: log4r-color/outputter/outputter.rb
|
61
|
+
For Formatters:: log4r-color/formatter/formatter.rb
|
62
|
+
For configuration:: log4r-color/configurator.rb
|
63
63
|
|
64
64
|
== Principal Classes of Log4r
|
65
65
|
|
@@ -75,7 +75,7 @@ look at the file overviews of those classes for more details.
|
|
75
75
|
|
76
76
|
== Remote Logging
|
77
77
|
|
78
|
-
Log4r provides a way to send log events over a network. See log4r/logserver.rb
|
78
|
+
Log4r provides a way to send log events over a network. See log4r-color/logserver.rb
|
79
79
|
for details.
|
80
80
|
|
81
81
|
== What's Going on Inside?
|
@@ -36,7 +36,7 @@ Logger#add method or set directly by modifying the Loggers#outputters array:
|
|
36
36
|
mylog.add('out7')
|
37
37
|
mylog.remove('out5','out7')
|
38
38
|
|
39
|
-
Please see log4r/outputter/outputter.rb and Log4r::Outputter for more about
|
39
|
+
Please see log4r-color/outputter/outputter.rb and Log4r::Outputter for more about
|
40
40
|
outputters.
|
41
41
|
|
42
42
|
== Logging Methods
|
@@ -154,7 +154,7 @@ RootLogger itself behaves as if its level were permanently set to
|
|
154
154
|
|
155
155
|
= XML Configuration
|
156
156
|
|
157
|
-
Please see log4r/configurator.rb for an overview of XML configuratoin.
|
157
|
+
Please see log4r-color/configurator.rb for an overview of XML configuratoin.
|
158
158
|
|
159
159
|
It's easy to configure a Logger in XML. The following example should be
|
160
160
|
sufficient:
|
@@ -21,7 +21,7 @@ RemoteOutputter on another host.
|
|
21
21
|
|
22
22
|
Setup is easy. First,
|
23
23
|
|
24
|
-
require 'log4r/logserver'
|
24
|
+
require 'log4r-color/logserver'
|
25
25
|
|
26
26
|
The following sets up a LogServer named 'central' on localhost port 9999:
|
27
27
|
|
@@ -43,7 +43,7 @@ forwarding a LogEvent to another Logger (as is done in hierarchical logging).
|
|
43
43
|
|
44
44
|
First,
|
45
45
|
|
46
|
-
require 'log4r/outputter/remoteoutputter'
|
46
|
+
require 'log4r-color/outputter/remoteoutputter'
|
47
47
|
|
48
48
|
Unlike typical outputters, RemoteOutputter doesn't do any formatting. That's
|
49
49
|
up to the LogServer's outputters. Otherwise, RemoteOutputter can be
|
@@ -37,9 +37,9 @@ The basic Outputter class is both abstract and a null object.
|
|
37
37
|
|
38
38
|
== Interesting Outputters
|
39
39
|
|
40
|
-
* log4r/outputter/syslogoutputter.rb - Logs to syslog
|
41
|
-
* log4r/outputter/emailoutputter.rb - Email logs
|
42
|
-
* log4r/logserver.rb - For remote logging
|
40
|
+
* log4r-color/outputter/syslogoutputter.rb - Logs to syslog
|
41
|
+
* log4r-color/outputter/emailoutputter.rb - Email logs
|
42
|
+
* log4r-color/logserver.rb - For remote logging
|
43
43
|
|
44
44
|
== Subclasses
|
45
45
|
|
@@ -98,7 +98,7 @@ Specify outputters as children of <tt><log4r_config></tt>:
|
|
98
98
|
</outputter>
|
99
99
|
...
|
100
100
|
|
101
|
-
As explained in log4r/configurator.rb, the hash arguments you would normally
|
101
|
+
As explained in log4r-color/configurator.rb, the hash arguments you would normally
|
102
102
|
pass to <tt>new</tt> are specified as <i>XML parameters</i>.
|
103
103
|
It is given an IO object to write
|
104
104
|
to, a Formatter to call, and, optionally, levels to write at.
|
@@ -110,7 +110,7 @@ Symbol equivalent) to <tt>PatternFormatter.new</tt>.
|
|
110
110
|
|
111
111
|
= XML Configuration
|
112
112
|
|
113
|
-
As explained in log4r/configurator.rb, the hash arguments to PatternFormatter
|
113
|
+
As explained in log4r-color/configurator.rb, the hash arguments to PatternFormatter
|
114
114
|
are <i>XML parameters</i>. Here's an example:
|
115
115
|
|
116
116
|
<formatter type="PatternFormatter" pattern="[%l] %d :: %.15m">
|
File without changes
|
@@ -7,12 +7,12 @@ Since syslog has its own formatting system, log4r formatters are ignored.
|
|
7
7
|
|
8
8
|
To use,
|
9
9
|
|
10
|
-
<tt>require 'log4r/outputter/syslogoutputter'</tt>
|
10
|
+
<tt>require 'log4r-color/outputter/syslogoutputter'</tt>
|
11
11
|
|
12
12
|
An example,
|
13
13
|
|
14
14
|
require 'log4r'
|
15
|
-
require 'log4r/outputter/syslogoutputter'
|
15
|
+
require 'log4r-color/outputter/syslogoutputter'
|
16
16
|
|
17
17
|
syslog = Log4r::SyslogOutputter.new("name", 'logopt'=>#, 'facility'=>#)
|
18
18
|
syslog.err("this is an ERR message")
|
File without changes
|
@@ -18,7 +18,7 @@ module Log4r
|
|
18
18
|
class Logger
|
19
19
|
|
20
20
|
# The repository stores a Hash of loggers keyed to their fullnames and
|
21
|
-
# provides a few functions to reduce the code bloat in log4r/logger.rb.
|
21
|
+
# provides a few functions to reduce the code bloat in log4r-color/logger.rb.
|
22
22
|
# This class is supposed to be transparent to end users, hence it is
|
23
23
|
# a class within Logger. If anyone knows how to make this private,
|
24
24
|
# let me know.
|
File without changes
|
@@ -4,10 +4,10 @@
|
|
4
4
|
#
|
5
5
|
# Version: $Id$
|
6
6
|
|
7
|
-
require "log4r/logger"
|
8
|
-
require "log4r/outputter/staticoutputter"
|
9
|
-
require "log4r/logserver"
|
10
|
-
require "log4r/outputter/remoteoutputter"
|
7
|
+
require "log4r-color/logger"
|
8
|
+
require "log4r-color/outputter/staticoutputter"
|
9
|
+
require "log4r-color/logserver"
|
10
|
+
require "log4r-color/outputter/remoteoutputter"
|
11
11
|
|
12
12
|
require 'yaml'
|
13
13
|
|
@@ -16,7 +16,7 @@ module Log4r
|
|
16
16
|
class ConfigError < Exception
|
17
17
|
end
|
18
18
|
|
19
|
-
# See log4r/yamlconfigurator.rb
|
19
|
+
# See log4r-color/yamlconfigurator.rb
|
20
20
|
class YamlConfigurator
|
21
21
|
@@params = Hash.new
|
22
22
|
|
data/lib/log4r-color.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
# :include: log4r-color/rdoc/log4r
|
2
|
+
#
|
3
|
+
# == Other Info
|
4
|
+
#
|
5
|
+
# Author:: Leon Torres
|
6
|
+
# Version:: $Id$
|
7
|
+
|
8
|
+
require "log4r-color/outputter/fileoutputter"
|
9
|
+
require "log4r-color/outputter/consoleoutputters"
|
10
|
+
require "log4r-color/outputter/staticoutputter"
|
11
|
+
require "log4r-color/outputter/rollingfileoutputter"
|
12
|
+
require "log4r-color/formatter/patternformatter"
|
13
|
+
require "log4r-color/loggerfactory"
|
14
|
+
require "log4r-color/GDC"
|
15
|
+
require "log4r-color/NDC"
|
16
|
+
require "log4r-color/MDC"
|
17
|
+
|
18
|
+
module Log4r
|
19
|
+
Log4rVersion = [1, 1, 9].join '.'
|
20
|
+
end
|
data/tests/testchainsaw.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
$: << File.join("..", "lib")
|
2
2
|
|
3
3
|
require 'log4r'
|
4
|
-
require 'log4r/staticlogger'
|
5
|
-
require 'log4r/formatter/log4jxmlformatter'
|
6
|
-
require 'log4r/outputter/udpoutputter'
|
7
|
-
require 'log4r/outputter/consoleoutputters'
|
4
|
+
require 'log4r-color/staticlogger'
|
5
|
+
require 'log4r-color/formatter/log4jxmlformatter'
|
6
|
+
require 'log4r-color/outputter/udpoutputter'
|
7
|
+
require 'log4r-color/outputter/consoleoutputters'
|
8
8
|
|
9
9
|
include Log4r
|
10
10
|
|
metadata
CHANGED
@@ -4,9 +4,8 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 1
|
7
|
-
-
|
8
|
-
|
9
|
-
version: 1.1.11
|
7
|
+
- 2
|
8
|
+
version: "1.2"
|
10
9
|
platform: ruby
|
11
10
|
authors:
|
12
11
|
- Colby Gutierrez-Kraybill, Kristian Mandrup (color outputter)
|
@@ -96,53 +95,53 @@ files:
|
|
96
95
|
- examples/syslogcustom.rb
|
97
96
|
- examples/xmlconfig.rb
|
98
97
|
- examples/yaml.rb
|
99
|
-
- lib/log4r/base.rb
|
100
|
-
- lib/log4r/config.rb
|
101
|
-
- lib/log4r/configurator.rb
|
102
|
-
- lib/log4r/formatter/formatter.rb
|
103
|
-
- lib/log4r/formatter/log4jxmlformatter.rb
|
104
|
-
- lib/log4r/formatter/patternformatter.rb
|
105
|
-
- lib/log4r/GDC.rb
|
106
|
-
- lib/log4r/lib/drbloader.rb
|
107
|
-
- lib/log4r/lib/xmlloader.rb
|
108
|
-
- lib/log4r/logevent.rb
|
109
|
-
- lib/log4r/logger.rb
|
110
|
-
- lib/log4r/loggerfactory.rb
|
111
|
-
- lib/log4r/logserver.rb
|
112
|
-
- lib/log4r/MDC.rb
|
113
|
-
- lib/log4r/NDC.rb
|
114
|
-
- lib/log4r/outputter/consoleoutputters.rb
|
115
|
-
- lib/log4r/outputter/datefileoutputter.rb
|
116
|
-
- lib/log4r/outputter/emailoutputter.rb
|
117
|
-
- lib/log4r/outputter/fileoutputter.rb
|
118
|
-
- lib/log4r/outputter/iooutputter.rb
|
119
|
-
- lib/log4r/outputter/outputter.rb
|
120
|
-
- lib/log4r/outputter/outputterfactory.rb
|
121
|
-
- lib/log4r/outputter/remoteoutputter.rb
|
122
|
-
- lib/log4r/outputter/rollingfileoutputter.rb
|
123
|
-
- lib/log4r/outputter/scribeoutputter.rb
|
124
|
-
- lib/log4r/outputter/staticoutputter.rb
|
125
|
-
- lib/log4r/outputter/syslogoutputter.rb
|
126
|
-
- lib/log4r/outputter/udpoutputter.rb
|
127
|
-
- lib/log4r/rdoc/configurator
|
128
|
-
- lib/log4r/rdoc/emailoutputter
|
129
|
-
- lib/log4r/rdoc/formatter
|
130
|
-
- lib/log4r/rdoc/GDC
|
131
|
-
- lib/log4r/rdoc/log4r
|
132
|
-
- lib/log4r/rdoc/logger
|
133
|
-
- lib/log4r/rdoc/logserver
|
134
|
-
- lib/log4r/rdoc/MDC
|
135
|
-
- lib/log4r/rdoc/NDC
|
136
|
-
- lib/log4r/rdoc/outputter
|
137
|
-
- lib/log4r/rdoc/patternformatter
|
138
|
-
- lib/log4r/rdoc/scribeoutputter
|
139
|
-
- lib/log4r/rdoc/syslogoutputter
|
140
|
-
- lib/log4r/rdoc/win32eventoutputter
|
141
|
-
- lib/log4r/rdoc/yamlconfigurator
|
142
|
-
- lib/log4r/repository.rb
|
143
|
-
- lib/log4r/staticlogger.rb
|
144
|
-
- lib/log4r/yamlconfigurator.rb
|
145
|
-
- lib/log4r.rb
|
98
|
+
- lib/log4r-color/base.rb
|
99
|
+
- lib/log4r-color/config.rb
|
100
|
+
- lib/log4r-color/configurator.rb
|
101
|
+
- lib/log4r-color/formatter/formatter.rb
|
102
|
+
- lib/log4r-color/formatter/log4jxmlformatter.rb
|
103
|
+
- lib/log4r-color/formatter/patternformatter.rb
|
104
|
+
- lib/log4r-color/GDC.rb
|
105
|
+
- lib/log4r-color/lib/drbloader.rb
|
106
|
+
- lib/log4r-color/lib/xmlloader.rb
|
107
|
+
- lib/log4r-color/logevent.rb
|
108
|
+
- lib/log4r-color/logger.rb
|
109
|
+
- lib/log4r-color/loggerfactory.rb
|
110
|
+
- lib/log4r-color/logserver.rb
|
111
|
+
- lib/log4r-color/MDC.rb
|
112
|
+
- lib/log4r-color/NDC.rb
|
113
|
+
- lib/log4r-color/outputter/consoleoutputters.rb
|
114
|
+
- lib/log4r-color/outputter/datefileoutputter.rb
|
115
|
+
- lib/log4r-color/outputter/emailoutputter.rb
|
116
|
+
- lib/log4r-color/outputter/fileoutputter.rb
|
117
|
+
- lib/log4r-color/outputter/iooutputter.rb
|
118
|
+
- lib/log4r-color/outputter/outputter.rb
|
119
|
+
- lib/log4r-color/outputter/outputterfactory.rb
|
120
|
+
- lib/log4r-color/outputter/remoteoutputter.rb
|
121
|
+
- lib/log4r-color/outputter/rollingfileoutputter.rb
|
122
|
+
- lib/log4r-color/outputter/scribeoutputter.rb
|
123
|
+
- lib/log4r-color/outputter/staticoutputter.rb
|
124
|
+
- lib/log4r-color/outputter/syslogoutputter.rb
|
125
|
+
- lib/log4r-color/outputter/udpoutputter.rb
|
126
|
+
- lib/log4r-color/rdoc/configurator
|
127
|
+
- lib/log4r-color/rdoc/emailoutputter
|
128
|
+
- lib/log4r-color/rdoc/formatter
|
129
|
+
- lib/log4r-color/rdoc/GDC
|
130
|
+
- lib/log4r-color/rdoc/log4r
|
131
|
+
- lib/log4r-color/rdoc/logger
|
132
|
+
- lib/log4r-color/rdoc/logserver
|
133
|
+
- lib/log4r-color/rdoc/MDC
|
134
|
+
- lib/log4r-color/rdoc/NDC
|
135
|
+
- lib/log4r-color/rdoc/outputter
|
136
|
+
- lib/log4r-color/rdoc/patternformatter
|
137
|
+
- lib/log4r-color/rdoc/scribeoutputter
|
138
|
+
- lib/log4r-color/rdoc/syslogoutputter
|
139
|
+
- lib/log4r-color/rdoc/win32eventoutputter
|
140
|
+
- lib/log4r-color/rdoc/yamlconfigurator
|
141
|
+
- lib/log4r-color/repository.rb
|
142
|
+
- lib/log4r-color/staticlogger.rb
|
143
|
+
- lib/log4r-color/yamlconfigurator.rb
|
144
|
+
- lib/log4r-color.rb
|
146
145
|
- tests/README
|
147
146
|
- tests/testall.rb
|
148
147
|
- tests/testbase.rb
|
data/lib/log4r.rb
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
# :include: log4r/rdoc/log4r
|
2
|
-
#
|
3
|
-
# == Other Info
|
4
|
-
#
|
5
|
-
# Author:: Leon Torres
|
6
|
-
# Version:: $Id$
|
7
|
-
|
8
|
-
require "log4r/outputter/fileoutputter"
|
9
|
-
require "log4r/outputter/consoleoutputters"
|
10
|
-
require "log4r/outputter/staticoutputter"
|
11
|
-
require "log4r/outputter/rollingfileoutputter"
|
12
|
-
require "log4r/formatter/patternformatter"
|
13
|
-
require "log4r/loggerfactory"
|
14
|
-
require "log4r/GDC"
|
15
|
-
require "log4r/NDC"
|
16
|
-
require "log4r/MDC"
|
17
|
-
|
18
|
-
module Log4r
|
19
|
-
Log4rVersion = [1, 1, 9].join '.'
|
20
|
-
end
|