Loggability::Formatter::HTML

The default log formatter class.

Constants

HTML_EXCEPTION_FORMAT

The format for dumping exceptions

HTML_LOG_FORMAT

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

Public Instance Methods

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

Format the message; Overridden to escape the progname.

# File lib/loggability/formatter/html.rb, line 43
def call( severity, time, progname, message )
        super( severity, time, escape_html(progname), message )
end

Protected Instance Methods

initialize( format=HTML_LOG_FORMAT ) click to toggle source

Override the logging formats with ones that generate HTML fragments

# File lib/loggability/formatter/html.rb, line 37
def initialize( format=HTML_LOG_FORMAT ) # :notnew:
        super
end
msg2str( object, severity ) click to toggle source

Format the specified object for output to the log.

# File lib/loggability/formatter/html.rb, line 53
def msg2str( object, severity )
        case object
        when String
                return escape_html( object )
        when Exception
                return HTML_EXCEPTION_FORMAT % [
                        object.class,
                        escape_html(object.message),
                        escape_html(object.backtrace.first)
                ]
        else
                return escape_html(object.inspect)
        end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.