Class: Loggability::Formatter::HTML
- Inherits:
-
Default
- Object
- Loggability::Formatter
- Default
- Loggability::Formatter::HTML
- Defined in:
- lib/loggability/formatter/html.rb
Overview
Output logs as HTML
Constant Summary collapse
- HTML_LOG_FORMAT =
The default HTML fragment that’ll be used as the template for each log message.
%q{ <div class="log-message %5$s-log-message"> <span class="log-time">%1$s.%2$06d</span> [ <span class="log-pid">%3$d</span> / <span class="log-tid">%4$s</span> ] <span class="log-level">%5$s</span> : <span class="log-name">%6$s</span> <span class="log-message-text">%7$s</span> </div> }.gsub( /[\t\n]/, ' ' )
- HTML_EXCEPTION_FORMAT =
The format for dumping exceptions
%Q{ <span class="log-exc">%1$p</span>: <span class="log-exc-message">%2$s</span> from <span class="log-exc-firstframe">%3$s</span> }.gsub( /[\t\n]/, ' ' )
Constants inherited from Default
Default::DEFAULT_DATETIME_FORMAT, Default::FORMAT
Instance Attribute Summary
Attributes inherited from Default
Attributes inherited from Loggability::Formatter
Instance Method Summary collapse
-
#call(severity, time, progname, message) ⇒ Object
Format the
message
; Overridden to escape theprogname
. -
#initialize(format = HTML_LOG_FORMAT) ⇒ HTML
constructor
Override the logging formats with ones that generate HTML fragments.
Methods inherited from Loggability::Formatter
Constructor Details
#initialize(format = HTML_LOG_FORMAT) ⇒ HTML
Override the logging formats with ones that generate HTML fragments
37 38 39 |
# File 'lib/loggability/formatter/html.rb', line 37 def initialize( format=HTML_LOG_FORMAT ) # :notnew: super end |
Instance Method Details
#call(severity, time, progname, message) ⇒ Object
Format the message
; Overridden to escape the progname
.
43 44 45 |
# File 'lib/loggability/formatter/html.rb', line 43 def call( severity, time, progname, ) super( severity, time, escape_html(progname), ) end |