Parent

Methods

Included Modules

Redleaf::HtmlLogFormatter

An alternate formatter for Logger instances that outputs dd HTML fragments.

Usage

  require 'redleaf/utils'
  Redleaf.logger.formatter = Redleaf::HtmlLogFormatter.new( Redleaf.logger )

Version

 $Id$

Authors

Copyright © 2008-2009, Michael Granger All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Constants

HTML_LOG_FORMAT

The default HTML fragment that’ll be used as the template for each log message.

Attributes

format[RW]

The HTML fragment that will be used as a format() string for the log

Public Instance Methods

call( severity, time, progname, msg ) click to toggle source

Return a log message composed out of the arguments formatted using the formatter’s format string

     # File lib/redleaf/utils.rb, line 309
309:         def call( severity, time, progname, msg )
310:             args = [
311:                 time.strftime( '%Y-%m-%d %H:%M:%S' ),                         # %1$s
312:                 time.usec,                                                    # %2$d
313:                 Process.pid,                                                  # %3$d
314:                 Thread.current == Thread.main ? 'main' : Thread.object_id,    # %4$s
315:                 severity.downcase,                                                     # %5$s
316:                 progname,                                                     # %6$s
317:                 html_escape( msg ).gsub(/\n/, '<br />')                       # %7$s
318:             ]
319: 
320:             return self.format % args
321:         end

Protected Instance Methods

initialize( logger, format=HTML_LOG_FORMAT ) click to toggle source

Override the logging formats with ones that generate HTML fragments

     # File lib/redleaf/utils.rb, line 292
292:         def initialize( logger, format=HTML_LOG_FORMAT ) # :notnew:
293:             @logger = logger
294:             @format = format
295:             super()
296:         end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.