Subversion Info

Rev
436
Last Checked In
2008-03-20 18:01:26 (3 weeks ago)
Checked in by
deveiant

Methods

Included Modules

Class Index

Quicksearch

Arrow::Logger::HtmlOutputter

Output logging messages in ANSI colors according to their level

Constants

SVNRev
SVN Revision
SVNId
SVN Id
DEFAULT_DESCRIPTION
Default decription used when creating instances
HTML_FORMAT
The default logging output format

Public Instance Methods

write( time, level, name, frame, msg ) click to toggle source

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

Protected Instance Methods

initialize( uri, description=DEFAULT_DESCRIPTION, format=HTML_FORMAT ) click to toggle source

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

secsequence

--- SEC00070

seccomment

--- ""

method_list

--- 
- 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\">&quot;Fuckery: &quot;</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\">/&lt;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

sectitle

--- 

constants

--- 
- 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: "&quot;HTML Fragment Logging Outputter&quot;"
- name: HTML_FORMAT
  desc: |+
    
    The default logging output format
    
  value: "%q{     &lt;div class=&quot;log-message #{level}&quot;&gt;         &lt;span class=&quot;log-time&quot;&gt;#{time.strftime('%Y/%m/%d %H:%M:%S')}&lt;/span&gt;         &lt;span class=&quot;log-level&quot;&gt;#{level}&lt;/span&gt;         :         &lt;span class=&quot;log-name&quot;&gt;#{escaped_name}&lt;/span&gt;         &lt;span class=&quot;log-frame&quot;&gt;#{frame ? '('+frame+'): ' : ''}&lt;/span&gt;         &lt;span class=&quot;log-message-text&quot;&gt;#{escaped_msg}&lt;/span&gt;     &lt;/div&gt;     }"

[Validate]

Generated with the Darkfish Rdoc Generator.