Treequel::

HtmlLogFormatter

class
Superclass
Logger::Formatter
Included Modules
ERB::Util

An alternate formatter for Logger instances that outputs div HTML fragments. @private

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

anchor
call( severity, time, progname, msg )

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

# File lib/treequel/utils.rb, line 163
def call( severity, time, progname, msg )
        args = [
                time.strftime( '%Y-%m-%d %H:%M:%S' ),                         # %1$s
                time.usec,                                                    # %2$d
                Process.pid,                                                  # %3$d
                Thread.current == Thread.main ? 'main' : Thread.object_id,    # %4$s
                severity.downcase,                                                     # %5$s
                progname,                                                     # %6$s
                html_escape( msg ).gsub(/\n/, '<br />')                       # %7$s
        ]

        return self.format % args
end

Protected Instance Methods

anchor
initialize( logger, format=HTML_LOG_FORMAT )

Override the logging formats with ones that generate HTML fragments

# File lib/treequel/utils.rb, line 146
def initialize( logger, format=HTML_LOG_FORMAT ) # :notnew:
        @logger = logger
        @format = format
        super()
end