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 /Users/ged/source/ruby/Arrow/lib/arrow/logger/htmloutputter.rb, line 61
61: def write( time, level, name, frame, msg )
62: escaped_msg = escape_html( msg )
63: escaped_name = escape_html( name )
64: html = @format.interpolate( binding )
65:
66: raise "Fuckery: " + self.inspect if html =~ /<div/
67:
68: @io.puts( html )
69: end
Override the default to add color scheme instance variable
# File /Users/ged/source/ruby/Arrow/lib/arrow/logger/htmloutputter.rb, line 51
51: def initialize( uri, description=DEFAULT_DESCRIPTION, format=HTML_FORMAT ) # :notnew:
52: super
53: end
--- SEC00070
--- ""
---
- methods:
- visibility: public
aref: M000188
name: write
sourcecode: " <span class=\"ruby-comment cmt\"># File /Users/ged/source/ruby/Arrow/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\">escaped_name</span> = <span class=\"ruby-identifier\">escape_html</span>( <span class=\"ruby-identifier\">name</span> )\n\
64: <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\
65: \n\
66: <span class=\"ruby-identifier\">raise</span> <span class=\"ruby-value str\">"Fuckery: "</span> <span class=\"ruby-operator\">+</span> <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">inspect</span> <span class=\"ruby-keyword kw\">if</span> <span class=\"ruby-identifier\">html</span> <span class=\"ruby-operator\">=~</span> <span class=\"ruby-regexp re\">/<div/</span>\n\
67: \n\
68: <span class=\"ruby-ivar\">@io</span>.<span class=\"ruby-identifier\">puts</span>( <span class=\"ruby-identifier\">html</span> )\n\
69: <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#M000188">write</a> the log message to $deferr.
</p>
params: ( time, level, name, frame, msg )
category: Instance
type: Public
- methods:
- visibility: protected
aref: M000187
name: initialize
sourcecode: " <span class=\"ruby-comment cmt\"># File /Users/ged/source/ruby/Arrow/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-constant\">HTML_FORMAT</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=HTML_FORMAT )
category: Instance
type: Protected
---
---
- name: SVNRev
desc: |+
SVN Revision
value: "%q$Rev: 436 $"
- name: SVNId
desc: |+
SVN Id
value: "%q$Id: htmloutputter.rb 436 2008-03-20 18:01:26Z 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">#{escaped_name}</span> <span class="log-frame">#{frame ? '('+frame+'): ' : ''}</span> <span class="log-message-text">#{escaped_msg}</span> </div> }"
Generated with the Darkfish Rdoc Generator.