Output logging messages in ANSI colors according to their level
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 $deferr.
# File lib/arrow/logger/htmloutputter.rb, line 61
61: def write( time, level, name, frame, msg )
62: escaped_msg = escape_html( msg )
63: html = @format.interpolate( binding )
64:
65: if block_given?
66: yield( html )
67: else
68: $deferr.puts( html ) if $DEBUG
69: end
70: end
--- SEC00069
--- ""
---
- methods:
- visibility: public
aref: M000186
name: write
sourcecode: " <span class=\"ruby-comment cmt\"># File lib/arrow/logger/htmloutputter.rb, line 61</span>\n\
61: <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">write</span>( <span class=\"ruby-identifier\">time</span>, <span class=\"ruby-identifier\">level</span>, <span class=\"ruby-identifier\">name</span>, <span class=\"ruby-identifier\">frame</span>, <span class=\"ruby-identifier\">msg</span> )\n\
62: <span class=\"ruby-identifier\">escaped_msg</span> = <span class=\"ruby-identifier\">escape_html</span>( <span class=\"ruby-identifier\">msg</span> )\n\
63: <span class=\"ruby-identifier\">html</span> = <span class=\"ruby-ivar\">@format</span>.<span class=\"ruby-identifier\">interpolate</span>( <span class=\"ruby-identifier\">binding</span> )\n\
64: \n\
65: <span class=\"ruby-keyword kw\">if</span> <span class=\"ruby-identifier\">block_given?</span>\n\
66: <span class=\"ruby-keyword kw\">yield</span>( <span class=\"ruby-identifier\">html</span> )\n\
67: <span class=\"ruby-keyword kw\">else</span>\n\
68: <span class=\"ruby-identifier\">$deferr</span>.<span class=\"ruby-identifier\">puts</span>( <span class=\"ruby-identifier\">html</span> ) <span class=\"ruby-keyword kw\">if</span> <span class=\"ruby-identifier\">$DEBUG</span>\n\
69: <span class=\"ruby-keyword kw\">end</span>\n\
70: <span class=\"ruby-keyword kw\">end</span>"
m_desc: |-
<p>
Write the given <tt>level</tt>, <tt>name</tt>, <tt>frame</tt>, and
<tt>msg</tt> 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,
<a href="HtmlOutputter.html#M000186">write</a> the log message to $deferr.
</p>
params: ( time, level, name, frame, msg ) {|html| ...}
category: Instance
type: Public
- methods:
- visibility: protected
aref: M000185
name: initialize
sourcecode: " <span class=\"ruby-comment cmt\"># File lib/arrow/logger/htmloutputter.rb, line 51</span>\n\
51: <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">initialize</span>( <span class=\"ruby-identifier\">uri</span>, <span class=\"ruby-identifier\">description</span>=<span class=\"ruby-constant\">DEFAULT_DESCRIPTION</span>, <span class=\"ruby-identifier\">format</span>=<span class=\"ruby-value str\">''</span> ) <span class=\"ruby-comment cmt\"># :notnew:</span>\n\
52: <span class=\"ruby-keyword kw\">super</span>\n\
53: <span class=\"ruby-keyword kw\">end</span>"
m_desc: |-
<p>
Override the default to add color scheme instance variable
</p>
params: ( uri, description=DEFAULT_DESCRIPTION, format='' )
category: Instance
type: Protected
---
---
- name: SVNRev
desc: |+
SVN Revision
value: "%q$Rev: 432 $"
- name: SVNId
desc: |+
SVN Id
value: "%q$Id: htmloutputter.rb 432 2008-02-20 19:26:10Z deveiant $"
- name: DEFAULT_DESCRIPTION
desc: |+
Default decription used when creating instances
value: ""HTML Fragment Logging Outputter""
- name: HTML_FORMAT
desc: |+
The default logging output format
value: "%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">#{name}</span> <span class="log-frame">#{frame ? '('+frame+'): ' : ''}</span> <span class="log-message-text">#{escaped_msg}</span> </div> }"
Generated with the Darkfish Rdoc Generator.