Loggability::Formatter::

HTML class

Output logs as HTML

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 )

Format the message; Overridden to escape the progname.

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

Protected Instance Methods

initialize( format=HTML_LOG_FORMAT )

Override the logging formats with ones that generate HTML fragments

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

Format the specified object for output to the log.

# File lib/loggability/formatter/html.rb, line 52
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