Class: Arrow::Logger::HtmlOutputter
- Inherits:
-
FileOutputter
- Object
- Outputter
- FileOutputter
- Arrow::Logger::HtmlOutputter
- Includes:
- Arrow::HTMLUtilities
- Defined in:
- lib/arrow/logger/htmloutputter.rb
Overview
Output logging messages in HTML fragments with classes that match their level.
Authors
Michael Granger
Please see the file LICENSE in the top-level directory for licensing details.
Constant Summary
- DEFAULT_DESCRIPTION =
Default decription used when creating instances
"HTML Fragment Logging Outputter"
- HTML_FORMAT =
The default logging output format
%q{ <div class="log-message #{level}"> <span class="log-time">#{time.strftime('%Y/%m/%d %H:%M:%S')}</span> <span class="log-level">#{level}</span> : <span class="log-name">#{escaped_name}</span> <span class="log-frame">#{frame ? '('+frame+'): ' : ''}</span> <span class="log-message-text">#{escaped_msg}</span> </div> }
Constants included from Arrow::HTMLUtilities
ARRAY_HTML_CONTAINER, HASH_HTML_CONTAINER, HASH_PAIR_HTML, IMMEDIATE_OBJECT_HTML_CONTAINER, IVAR_HTML_FRAGMENT, OBJECT_HTML_CONTAINER, THREAD_DUMP_KEY
Constants inherited from FileOutputter
DEFAULT_DESCRIPTION, DEFAULT_FORMAT
Constants inherited from Outputter
DEFAULT_DESCRIPTION, DEFAULT_FORMAT
Instance Method Summary
-
- (HtmlOutputter) initialize(uri, description = DEFAULT_DESCRIPTION, format = HTML_FORMAT)
constructor
Override the default argument values.
-
- (Object) write(time, level, name, frame, msg)
Write the given level, name, frame, and msg to the target output mechanism.
Methods included from Arrow::HTMLUtilities
#escape_html, #make_html_for_object, #make_object_html_wrapper
Methods inherited from FileOutputter
Methods inherited from Outputter
create, derivativeDirs, #inspect, #inspection_details, parse_uri
Constructor Details
- (HtmlOutputter) initialize(uri, description = DEFAULT_DESCRIPTION, format = HTML_FORMAT)
Override the default argument values.
34 35 36 |
# File 'lib/arrow/logger/htmloutputter.rb', line 34 def initialize( uri, description=DEFAULT_DESCRIPTION, format=HTML_FORMAT ) # :notnew: super end |
Instance Method Details
- (Object) write(time, level, name, frame, msg)
Write the given level, name, frame, and msg to the target output mechanism. Subclasses can call this with a block which will be passed the formatted message. If no block is supplied by the child, this method will check to see if $DEBUG is set, and if it is, write the log message to $stderr.
44 45 46 47 48 49 50 |
# File 'lib/arrow/logger/htmloutputter.rb', line 44 def write( time, level, name, frame, msg ) escaped_msg = escape_html( msg ) escaped_name = escape_html( name ) html = @format.interpolate( binding ) @io.puts( html ) end |