log4r-color 1.2 → 1.2.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,143 @@
1
+ h1. A flexible logging library for Ruby, now in color
2
+
3
+ This project is currently decoupled from the main _log4r_ project which it rests on.
4
+ The main addition to log4r in this project is the _ColorOutputter_ which uses "colorize":https://github.com/fazibear/colorize to display logs in the console/terminal with colorschemes for each log level to make it easy to distinquish them.
5
+
6
+ This project is used in "logging_assist":https://github.com/kristianmandrup/logging_assist which wraps log4r-color in a convenient DSL syntax.
7
+
8
+ h2. Release
9
+
10
+ This release: *1.2*
11
+ Release date: *Jan/2011*
12
+ License: LGPLv3
13
+
14
+ h2. Contributors
15
+
16
+ * Colby Gutierrez-Kraybill
17
+ * Kristian Mandrup (ColorOutputter)
18
+ * Leon Torres - Original Maintainer
19
+ * Martain Stannard - RollingFileOutputter
20
+ * Steve Lumos - SyslogOutputter
21
+ * Mark Lewandowski - ScribeOutputter
22
+ * Andreas Hund - YamlConfigurator
23
+ * Jamis Buck - log4r.gemspec
24
+ * Charles Strahan - log4jxml/chainsaw integration
25
+ * Nitay Joffe - STARTTLS
26
+ * David Siegal - Smart updates to RollingFileOutputter
27
+
28
+ "Homepage":http://log4r.rubyforge.org/
29
+ "Download":http://rubyforge.org/frs/?group_id=203
30
+
31
+ h2. Summary
32
+
33
+ Log4r is a comprehensive and flexible logging library written in Ruby for use
34
+ in Ruby programs. It features a hierarchical logging system of any number of
35
+ levels, custom level names, logger inheritance, multiple output destinations
36
+ per log event, execution tracing, custom formatting, thread safteyness, XML
37
+ and YAML configuration, and more.
38
+
39
+
40
+ h2. Requirements
41
+
42
+ * (required) Ruby >= 1.7.0 (use log4r 1.0.2 for Ruby 1.6)
43
+ * (optional) RubyGems for installing Log4r as a gem
44
+ * (optional) Ruby syslog library for SyslogOutputter
45
+ * (optional) XML configuration requires REXML
46
+ * (optional) log4j chainsaw integration requires 'builder' >= 2.0
47
+ * (optional) STARTTLS email login, requires 'smtp_tls" if Ruby <= 1.8.6
48
+
49
+ h3. Gem requirements
50
+
51
+ * colorize
52
+ * scribe
53
+
54
+ h2. Install
55
+
56
+ <code>gem install log4r-color</code>
57
+
58
+ h2. Usage
59
+
60
+ Here is an example of setting up a logger with ColorOutputter using a color scheme. While logging, one of the color schemes is changed and it applies immediately to log messages after.
61
+
62
+ <pre>require 'log4r-color'
63
+ include Log4r
64
+
65
+ Logger.global.level = ALL
66
+ formatter = PatternFormatter.new(:pattern => "%l - %m - %c")
67
+
68
+ ColorOutputter.new 'color', {:colors =>
69
+ {
70
+ :debug => :light_blue,
71
+ :info => :light_blue,
72
+ :warn => :yellow,
73
+ :error => :red,
74
+ :fatal => {:color => :red, :background => :white}
75
+ }
76
+ }
77
+
78
+ Logger.new('color_logger', DEBUG).add('color')
79
+
80
+ def do_logging(log)
81
+ puts "--"
82
+ log.debug "This is debug"
83
+ log.info "This is info"
84
+ log.warn "This is warn"
85
+ Outputter['color'].colors[:info] = :green
86
+ log.info "This is info again, now in green"
87
+ log.error "This is error"
88
+ log.fatal "This is fatal"
89
+ end
90
+
91
+ do_logging Logger['color_logger']
92
+
93
+ Note: You can set the log levels you allow via the `Log4r.LNAMES` constant, by default set to `['ALL']` to allow any log level.
94
+
95
+ </pre>
96
+
97
+ h2. More Info
98
+
99
+ * Installation instructions are in the file INSTALL
100
+
101
+ * Comprehensive examples are provided in examples/ and can be run right away
102
+
103
+ * Log4r homepage: doc/index.html
104
+ Online: http://log4r.rubyforge.org/
105
+
106
+ * Manual: doc/manual.html
107
+ Online: http://log4r.rubyforge.org/manual.html
108
+
109
+ * RDoc API reference: doc/rdoc/index.html
110
+ Online: http://log4r.rubyforge.org/rdoc/index.html
111
+
112
+ * The changelog
113
+
114
+ * Log4r is hosted by RubyForge, which provides news, bug tracking and a forum
115
+
116
+ * Feel free to bug the maintainer with any questions (listed at top of file)
117
+
118
+
119
+ h2. Usability
120
+
121
+ Log4r works really well, so please take advantage of it right away! :)
122
+ All versions since 0.9.2 have been stable and backward-compatible. The
123
+ code is stable enough that updates are infrequent and usually only for
124
+ adding features or keeping the code up to date with Ruby.
125
+
126
+
127
+ h2. Platform Issues
128
+
129
+ Log4r is known to work on Linux and WindowsXP. It's safe to assume that Log4r
130
+ will work on any Ruby-supported platform.
131
+
132
+
133
+ h2. When Trouble Strikes
134
+
135
+ Log4r comes with an internal logger. To see its output, create a logger
136
+ named 'log4r' before any others and give it a suitable outputter,
137
+
138
+ <pre>
139
+ trouble = Logger.new['log4r']
140
+ trouble.add Outputter.stdout
141
+ </pre>
142
+
143
+
data/Rakefile CHANGED
@@ -10,7 +10,7 @@ require 'date'
10
10
  require 'fileutils'
11
11
 
12
12
  GEM = "log4r-color"
13
- GEM_VERSION = "1.2"
13
+ GEM_VERSION = "1.2.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}
@@ -206,7 +206,7 @@ destinations as well as its own. This behavior is optional, but allows one
206
206
  to structure a powerful, and easily configurable logging system.
207
207
  <p/>
208
208
  To find out more about loggers, please see
209
- <a href="rdoc/files/log4r/logger_rb.html">rdoc/files/log4r/logger_rb.html</a>.
209
+ <a href="rdoc/files/log4r-color/logger_rb.html">rdoc/files/log4r-color/logger_rb.html</a>.
210
210
  <p><hr noshade color="#AA0000">
211
211
  <a name="outputters">
212
212
  <h4 ><a href="#toc">Outputters</a></h4>
@@ -227,8 +227,8 @@ extending log4r outputters, the well documented code and the open source
227
227
  license.
228
228
  <p/>
229
229
  To find out more about outputters, please see
230
- <a href="rdoc/files/log4r/outputter/outputter_rb.html">
231
- rdoc/files/log4r/outputter/outputter_rb.html</a>.
230
+ <a href="rdoc/files/log4r-color/outputter/outputter_rb.html">
231
+ rdoc/files/log4r-color/outputter/outputter_rb.html</a>.
232
232
  <p><hr noshade color="#AA0000">
233
233
  <a name="formatters">
234
234
  <h4 ><a href="#toc">Formatters</a></h4>
@@ -238,12 +238,12 @@ PatternFormatter uses sprintf-like directives to format log messages and
238
238
  eliminates the need for custom Formatters.
239
239
  <p/>
240
240
  To find out more about formatters, please see
241
- <a href="rdoc/files/log4r/formatter/formatter_rb.html">
242
- rdoc/files/log4r/formatter/formatter_rb.html</a>.
241
+ <a href="rdoc/files/log4r-color/formatter/formatter_rb.html">
242
+ rdoc/files/log4r-color/formatter/formatter_rb.html</a>.
243
243
  <br/>
244
244
  To find out more about PatternFormatter, please see
245
- <a href="rdoc/files/log4r/formatter/patternformatter_rb.html">
246
- rdoc/files/log4r/formatter/patternformatter_rb.html</a>.
245
+ <a href="rdoc/files/log4r-color/formatter/patternformatter_rb.html">
246
+ rdoc/files/log4r-color/formatter/patternformatter_rb.html</a>.
247
247
  <p><hr noshade color="#AA0000">
248
248
  <a name="config">
249
249
  <h4 ><a href="#toc">Configuration</a></h4>
@@ -256,10 +256,10 @@ be configured without needing to write extra code. This is acomplished by
256
256
  taking advantage of Ruby's powerful reflection capabilities.
257
257
  <p/>
258
258
  To find out more about configuration, please see
259
- <a href="rdoc/files/log4r/configurator_rb.html">rdoc/files/log4r/configurator_rb.html</a>.
259
+ <a href="rdoc/files/log4r-color/configurator_rb.html">rdoc/files/log4r-color/configurator_rb.html</a>.
260
260
  <br/>
261
261
  For YAML configuration, also see
262
- <a href="rdoc/files/log4r/yamlconfigurator_rb.html">rdoc/files/log4r/yamlconfigurator.html</a>
262
+ <a href="rdoc/files/log4r-color/yamlconfigurator_rb.html">rdoc/files/log4r-color/yamlconfigurator.html</a>
263
263
 
264
264
  <p><hr noshade color="#AA0000">
265
265
  <a name="remote">
@@ -270,8 +270,8 @@ This is accomplished using the distributed Ruby library ROMP, a subclass of
270
270
  Logger called LogServer, and a RemoteOutputter.
271
271
  <p/>
272
272
  To find out more about remote logging, please see
273
- <a href="rdoc/files/log4r/logserver_rb.html">
274
- rdoc/files/log4r/logserver_rb.html</a>
273
+ <a href="rdoc/files/log4r-color/logserver_rb.html">
274
+ rdoc/files/log4r-color/logserver_rb.html</a>
275
275
  <p/>
276
276
  Alternatively, one can just send log reports via email using EmailOutputter.
277
277
  <p/>
@@ -10,7 +10,7 @@ Project Full Name: Log4r
10
10
  Project Unix Name: log4r
11
11
  CVS Server: cvs.log4r.rubyforge.org
12
12
  Shell/Web Server: log4r.rubyforge.org
13
- Path to web pages: /var/www/gforge-projects/log4r/
13
+ Path to web pages: /var/www/gforge-projects/log4r-color/
14
14
 
15
15
 
16
16
  HTML manual and site
@@ -27,7 +27,7 @@
27
27
  <tr><td><a href="http://sourceforge.net/project/showfiles.php?group_id=43396">
28
28
  Download</a></td></tr>
29
29
  <tr><td nowrap="true">
30
- <a href="http://rubyforge.org/projects/log4r/">@ RubyForge</a>
30
+ <a href="http://rubyforge.org/projects/log4r-color/">@ RubyForge</a>
31
31
  </td></tr>
32
32
  <tr><td>
33
33
  <a href="license.html">License</a>
@@ -56,16 +56,16 @@ module Log4r
56
56
  raise ArgumentError, "Colors option must consist of a hash where each key is the log level to define a color scheme for" if !colors.kind_of? Hash
57
57
  invalid_levels = colors.keys.reject {|level| valid_levels.include? level}
58
58
  if !invalid_levels.empty?
59
- raise ArgumentError, "Color schemes can not be defined for these invalid log levels: #{invalid_levels.join(', ')}"
59
+ raise ArgumentError, "Color schemes cannot be defined for these invalid log levels: #{invalid_levels.join(', ')}"
60
60
  end
61
61
  end
62
62
 
63
63
  def self.level_key level
64
- valid_levels[level -1]
64
+ valid_levels[level]
65
65
  end
66
66
 
67
67
  def self.valid_levels
68
- [:debug, :info, :warn, :error, :fatal]
68
+ LNAMES.collect { |level| level.downcase.to_sym }
69
69
  end
70
70
 
71
71
  # Shortcut for decoding 'true', 'false', true, false or nil into a bool
@@ -95,7 +95,7 @@ module Log4r
95
95
  ### build a mail header for RFC 822
96
96
  rfc822msg =
97
97
  "From: #{@from}\n" +
98
- "To: #{@to}\n" +
98
+ "To: #{@to.join(', ')}\n" +
99
99
  "Subject: #{@subject}\n" +
100
100
  "Date: #{Time.now.strftime( "%a, %d %b %Y %H:%M:%S %z %Z")}\n" +
101
101
  "Message-Id: <#{"%.8f" % Time.now.to_f}@#{@domain}>\n\n" +
metadata CHANGED
@@ -1,61 +1,60 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: log4r-color
3
- version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 1
7
- - 2
8
- version: "1.2"
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.2.2
5
+ prerelease:
9
6
  platform: ruby
10
- authors:
7
+ authors:
11
8
  - Colby Gutierrez-Kraybill, Kristian Mandrup (color outputter)
12
9
  autorequire:
13
10
  bindir: bin
14
11
  cert_chain: []
15
-
16
- date: 2011-01-09 00:00:00 +01:00
17
- default_executable:
18
- dependencies:
19
- - !ruby/object:Gem::Dependency
12
+ date: 2012-09-09 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
20
15
  name: scribe
21
- prerelease: false
22
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
23
17
  none: false
24
- requirements:
25
- - - ">="
26
- - !ruby/object:Gem::Version
27
- segments:
28
- - 0
29
- version: "0"
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
30
22
  type: :runtime
31
- version_requirements: *id001
32
- - !ruby/object:Gem::Dependency
33
- name: colorize
34
23
  prerelease: false
35
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: !ruby/object:Gem::Requirement
36
25
  none: false
37
- requirements:
38
- - - ">="
39
- - !ruby/object:Gem::Version
40
- segments:
41
- - 0
42
- version: "0"
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: colorize
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
43
38
  type: :runtime
44
- version_requirements: *id002
45
- description: "See also: http://logging.apache.org/log4j"
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ description: ! 'See also: http://logging.apache.org/log4j'
46
47
  email: colby@astro.berkeley.edu, kmandrup@gmail.com
47
48
  executables: []
48
-
49
49
  extensions: []
50
-
51
- extra_rdoc_files:
52
- - README
50
+ extra_rdoc_files:
51
+ - README.textile
53
52
  - LICENSE
54
53
  - TODO
55
- files:
54
+ files:
56
55
  - LICENSE
57
56
  - LICENSE.LGPLv3
58
- - README
57
+ - README.textile
59
58
  - INSTALL
60
59
  - Rakefile
61
60
  - TODO
@@ -158,37 +157,29 @@ files:
158
157
  - tests/testpatternformatter.rb
159
158
  - tests/testthreads.rb
160
159
  - tests/testxmlconf.rb
161
- has_rdoc: true
162
160
  homepage: http://log4r.rubyforge.org
163
161
  licenses: []
164
-
165
162
  post_install_message:
166
163
  rdoc_options: []
167
-
168
- require_paths:
164
+ require_paths:
169
165
  - lib
170
- required_ruby_version: !ruby/object:Gem::Requirement
166
+ required_ruby_version: !ruby/object:Gem::Requirement
171
167
  none: false
172
- requirements:
173
- - - ">="
174
- - !ruby/object:Gem::Version
175
- segments:
176
- - 0
177
- version: "0"
178
- required_rubygems_version: !ruby/object:Gem::Requirement
168
+ requirements:
169
+ - - ! '>='
170
+ - !ruby/object:Gem::Version
171
+ version: '0'
172
+ required_rubygems_version: !ruby/object:Gem::Requirement
179
173
  none: false
180
- requirements:
181
- - - ">="
182
- - !ruby/object:Gem::Version
183
- segments:
184
- - 0
185
- version: "0"
174
+ requirements:
175
+ - - ! '>='
176
+ - !ruby/object:Gem::Version
177
+ version: '0'
186
178
  requirements: []
187
-
188
179
  rubyforge_project: log4r-color
189
- rubygems_version: 1.3.7
180
+ rubygems_version: 1.8.24
190
181
  signing_key:
191
182
  specification_version: 3
192
183
  summary: Log4r, logging framework for ruby
193
184
  test_files: []
194
-
185
+ has_rdoc:
data/README DELETED
@@ -1,95 +0,0 @@
1
- Log4r - A flexible logging library for Ruby
2
-
3
-
4
- This release: 1.1.9 - ALPHA
5
- Release date: XX/Jun/2010
6
- License: LGPLv3
7
- Maintainer: Colby Gutierrez-Kraybill
8
- Contributors: Leon Torres Original Maintainer
9
- Martain Stannard RollingFileOutputter
10
- Steve Lumos SyslogOutputter
11
- Mark Lewandowski ScribeOutputter
12
- Andreas Hund YamlConfigurator
13
- Jamis Buck log4r.gemspec
14
- Charles Strahan log4jxml/chainsaw integration
15
- Nitay Joffe STARTTLS
16
- David Siegal Smart updates to RollingFileOutputter
17
- Homepage: http://log4r.rubyforge.org/
18
- Download: http://rubyforge.org/frs/?group_id=203
19
-
20
- Summary
21
- -------
22
-
23
- Log4r is a comprehensive and flexible logging library written in Ruby for use
24
- in Ruby programs. It features a hierarchical logging system of any number of
25
- levels, custom level names, logger inheritance, multiple output destinations
26
- per log event, execution tracing, custom formatting, thread safteyness, XML
27
- and YAML configuration, and more.
28
-
29
-
30
- Requirements
31
- ------------
32
-
33
- * (required) Ruby >= 1.7.0 (use log4r 1.0.2 for Ruby 1.6)
34
- * (optional) RubyGems for installing Log4r as a gem
35
- * (optional) Ruby syslog library for SyslogOutputter
36
- * (optional) XML configuration requires REXML
37
- * (optional) log4j chainsaw integration requires 'builder' >= 2.0
38
- * (optional) STARTTLS email login, requires 'smtp_tls" if Ruby <= 1.8.6
39
-
40
-
41
- More Info
42
- ---------
43
-
44
- * Installation instructions are in the file INSTALL
45
-
46
- * Comprehensive examples are provided in examples/ and can be run right away
47
-
48
- * Log4r homepage: doc/index.html
49
- Online: http://log4r.rubyforge.org/
50
-
51
- * Manual: doc/manual.html
52
- Online: http://log4r.rubyforge.org/manual.html
53
-
54
- * RDoc API reference: doc/rdoc/index.html
55
- Online: http://log4r.rubyforge.org/rdoc/index.html
56
-
57
- * The changelog
58
-
59
- * Log4r is hosted by RubyForge, which provides news, bug tracking and a forum
60
-
61
- * Feel free to bug the maintainer with any questions (listed at top of file)
62
-
63
-
64
- Usability
65
- ---------
66
-
67
- Log4r works really well, so please take advantage of it right away! :)
68
- All versions since 0.9.2 have been stable and backward-compatible. The
69
- code is stable enough that updates are infrequent and usually only for
70
- adding features or keeping the code up to date with Ruby.
71
-
72
-
73
- Platform Issues
74
- ---------------
75
-
76
- Log4r is known to work on Linux and WindowsXP. It's safe to assume that Log4r
77
- will work on any Ruby-supported platform.
78
-
79
-
80
- When Trouble Strikes
81
- --------------------
82
-
83
- Log4r comes with an internal logger. To see its output, create a logger
84
- named 'log4r' before any others and give it a suitable outputter,
85
-
86
- trouble = Logger.new['log4r']
87
- trouble.add Outputter.stdout
88
-
89
- Try running the unit tests provided (run the file tests/runtest.rb). Let
90
- the maintainer know what's up and feel free to explore and fix the
91
- code yourself. It's well documented and written in Ruby. :)
92
-
93
- Also, try out the bug/request tracking system at
94
- http://rubyforge.org/tracker/?group_id=203
95
-