Object
This class is the abstract base class for logging outputters for Arrow::Logger.
Create a new Arrow::Logger::Outputter object of the type specified by uri.
# File /Users/ged/source/ruby/Arrow/lib/arrow/logger/outputter.rb, line 72
72: def self::create( uri, *args )
73: uri = self.parse_uri( uri ) if uri.is_a?( String )
74: super( uri.scheme.dup, uri, *args )
75: end
Specify the directory to look for the derivatives of this class in.
# File /Users/ged/source/ruby/Arrow/lib/arrow/logger/outputter.rb, line 56
56: def self::derivativeDirs
57: ["arrow/logger"]
58: end
Create a new Arrow::Logger::Outputter object with the given uri, description and sprintf-style format.
# File /Users/ged/source/ruby/Arrow/lib/arrow/logger/outputter.rb, line 85
85: def initialize( uri, description=DefaultDescription, format=DefaultFormat )
86: @description = description
87: @format = format
88: end
Parse the given string into a URI object, appending the path part if it doesn‘t exist.
# File /Users/ged/source/ruby/Arrow/lib/arrow/logger/outputter.rb, line 63
63: def self::parse_uri( str )
64: return str if str.is_a?( URI::Generic )
65: str += ":." if str.match( /^\w+$/ )
66: URI.parse( str )
67: end
Returns a human-readable description of the object as a String
# File /Users/ged/source/ruby/Arrow/lib/arrow/logger/outputter.rb, line 121
121: def inspect
122: "#<%s:0x%0x %s>" % [
123: self.class.name,
124: self.object_id * 2,
125: self.inspection_details,
126: ]
127: end
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/outputter.rb, line 109
109: def write( time, level, name, frame, msg )
110: msg = @format.interpolate( binding )
111:
112: if block_given?
113: yield( msg )
114: else
115: $deferr.puts( msg ) if $DEBUG
116: end
117: end
Returns a String which should be included in the implementation-specific part of the object‘s inspection String.
# File /Users/ged/source/ruby/Arrow/lib/arrow/logger/outputter.rb, line 136
136: def inspection_details
137: return "%s (%s)" % [ self.description, self.format ]
138: end
--- SEC00072
--- ""
---
- name: description
rw: RW
a_desc: |+
The outputter‘s description, for introspection utilities.
- name: format
rw: RW
a_desc: |+
The uninterpolated string format for this outputter. This message written
will be formed by interpolating this string in the <a
href="Outputter.html#M000193">#write</a> method‘s context immediately
before outputting.
---
- methods:
- visibility: public
aref: M000191
name: create
sourcecode: " <span class=\"ruby-comment cmt\"># File /Users/ged/source/ruby/Arrow/lib/arrow/logger/outputter.rb, line 72</span>\n\
72: <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-keyword kw\">self</span><span class=\"ruby-operator\">::</span><span class=\"ruby-identifier\">create</span>( <span class=\"ruby-identifier\">uri</span>, <span class=\"ruby-operator\">*</span><span class=\"ruby-identifier\">args</span> )\n\
73: <span class=\"ruby-identifier\">uri</span> = <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">parse_uri</span>( <span class=\"ruby-identifier\">uri</span> ) <span class=\"ruby-keyword kw\">if</span> <span class=\"ruby-identifier\">uri</span>.<span class=\"ruby-identifier\">is_a?</span>( <span class=\"ruby-constant\">String</span> )\n\
74: <span class=\"ruby-keyword kw\">super</span>( <span class=\"ruby-identifier\">uri</span>.<span class=\"ruby-identifier\">scheme</span>.<span class=\"ruby-identifier\">dup</span>, <span class=\"ruby-identifier\">uri</span>, <span class=\"ruby-operator\">*</span><span class=\"ruby-identifier\">args</span> )\n\
75: <span class=\"ruby-keyword kw\">end</span>"
m_desc: |-
<p>
Create a <a href="Outputter.html#M000192">new</a> <a
href="Outputter.html">Arrow::Logger::Outputter</a> object of the type
specified by <tt>uri</tt>.
</p>
params: ( uri, *args )
- visibility: public
aref: M000189
name: derivativeDirs
sourcecode: " <span class=\"ruby-comment cmt\"># File /Users/ged/source/ruby/Arrow/lib/arrow/logger/outputter.rb, line 56</span>\n\
56: <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-keyword kw\">self</span><span class=\"ruby-operator\">::</span><span class=\"ruby-identifier\">derivativeDirs</span>\n\
57: [<span class=\"ruby-value str\">"arrow/logger"</span>]\n\
58: <span class=\"ruby-keyword kw\">end</span>"
m_desc: |-
<p>
Specify the directory to look for the derivatives of this class in.
</p>
params: ()
- visibility: public
aref: M000192
name: new
sourcecode: " <span class=\"ruby-comment cmt\"># File /Users/ged/source/ruby/Arrow/lib/arrow/logger/outputter.rb, line 85</span>\n\
85: <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\">DefaultDescription</span>, <span class=\"ruby-identifier\">format</span>=<span class=\"ruby-constant\">DefaultFormat</span> )\n\
86: <span class=\"ruby-ivar\">@description</span> = <span class=\"ruby-identifier\">description</span>\n\
87: <span class=\"ruby-ivar\">@format</span> = <span class=\"ruby-identifier\">format</span>\n\
88: <span class=\"ruby-keyword kw\">end</span>"
m_desc: |-
<p>
Create a <a href="Outputter.html#M000192">new</a> <a
href="Outputter.html">Arrow::Logger::Outputter</a> object with the given
<tt>uri</tt>, <tt>description</tt> and sprintf-style <tt>format</tt>.
</p>
params: ( uri, description=DefaultDescription, format=DefaultFormat )
- visibility: public
aref: M000190
name: parse_uri
sourcecode: " <span class=\"ruby-comment cmt\"># File /Users/ged/source/ruby/Arrow/lib/arrow/logger/outputter.rb, line 63</span>\n\
63: <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-keyword kw\">self</span><span class=\"ruby-operator\">::</span><span class=\"ruby-identifier\">parse_uri</span>( <span class=\"ruby-identifier\">str</span> )\n\
64: <span class=\"ruby-keyword kw\">return</span> <span class=\"ruby-identifier\">str</span> <span class=\"ruby-keyword kw\">if</span> <span class=\"ruby-identifier\">str</span>.<span class=\"ruby-identifier\">is_a?</span>( <span class=\"ruby-constant\">URI</span><span class=\"ruby-operator\">::</span><span class=\"ruby-constant\">Generic</span> )\n\
65: <span class=\"ruby-identifier\">str</span> <span class=\"ruby-operator\">+=</span> <span class=\"ruby-value str\">":."</span> <span class=\"ruby-keyword kw\">if</span> <span class=\"ruby-identifier\">str</span>.<span class=\"ruby-identifier\">match</span>( <span class=\"ruby-regexp re\">/^\\w+$/</span> )\n\
66: <span class=\"ruby-constant\">URI</span>.<span class=\"ruby-identifier\">parse</span>( <span class=\"ruby-identifier\">str</span> )\n\
67: <span class=\"ruby-keyword kw\">end</span>"
m_desc: |-
<p>
Parse the given string into a URI object, appending the path part if it
doesn‘t exist.
</p>
params: ( str )
category: Class
type: Public
- methods:
- visibility: public
aref: M000194
name: inspect
sourcecode: " <span class=\"ruby-comment cmt\"># File /Users/ged/source/ruby/Arrow/lib/arrow/logger/outputter.rb, line 121</span>\n\
121: <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">inspect</span>\n\
122: <span class=\"ruby-value str\">"#<%s:0x%0x %s>"</span> <span class=\"ruby-operator\">%</span> [\n\
123: <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">class</span>.<span class=\"ruby-identifier\">name</span>,\n\
124: <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">object_id</span> <span class=\"ruby-operator\">*</span> <span class=\"ruby-value\">2</span>,\n\
125: <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">inspection_details</span>,\n\
126: ]\n\
127: <span class=\"ruby-keyword kw\">end</span>"
m_desc: |-
<p>
Returns a human-readable description of the object as a String
</p>
params: ()
- visibility: public
aref: M000193
name: write
sourcecode: " <span class=\"ruby-comment cmt\"># File /Users/ged/source/ruby/Arrow/lib/arrow/logger/outputter.rb, line 109</span>\n\
109: <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\
110: <span class=\"ruby-identifier\">msg</span> = <span class=\"ruby-ivar\">@format</span>.<span class=\"ruby-identifier\">interpolate</span>( <span class=\"ruby-identifier\">binding</span> )\n\
111: \n\
112: <span class=\"ruby-keyword kw\">if</span> <span class=\"ruby-identifier\">block_given?</span>\n\
113: <span class=\"ruby-keyword kw\">yield</span>( <span class=\"ruby-identifier\">msg</span> )\n\
114: <span class=\"ruby-keyword kw\">else</span>\n\
115: <span class=\"ruby-identifier\">$deferr</span>.<span class=\"ruby-identifier\">puts</span>( <span class=\"ruby-identifier\">msg</span> ) <span class=\"ruby-keyword kw\">if</span> <span class=\"ruby-identifier\">$DEBUG</span>\n\
116: <span class=\"ruby-keyword kw\">end</span>\n\
117: <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="Outputter.html#M000193">write</a> the log message to $deferr.
</p>
params: ( time, level, name, frame, msg ) {|msg| ...}
category: Instance
type: Public
- methods:
- visibility: protected
aref: M000195
name: inspection_details
sourcecode: " <span class=\"ruby-comment cmt\"># File /Users/ged/source/ruby/Arrow/lib/arrow/logger/outputter.rb, line 136</span>\n\
136: <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">inspection_details</span>\n\
137: <span class=\"ruby-keyword kw\">return</span> <span class=\"ruby-value str\">"%s (%s)"</span> <span class=\"ruby-operator\">%</span> [ <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">description</span>, <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">format</span> ]\n\
138: <span class=\"ruby-keyword kw\">end</span>"
m_desc: |-
<p>
Returns a String which should be included in the implementation-specific
part of the object‘s inspection String.
</p>
params: ()
category: Instance
type: Protected
---
---
- name: SVNRev
desc: |+
SVN Revision
value: "%q$Rev: 437 $"
- name: SVNId
desc: |+
SVN Id
value: "%q$Id: outputter.rb 437 2008-03-28 00:49:20Z deveiant $"
- name: DefaultDescription
desc: |+
The default description
value: ""Logging Outputter""
- name: DefaultFormat
desc: |+
The default interpolatable string that‘s used to build the message to
output
value: "%q{#{time.strftime('%Y/%m/%d %H:%M:%S')} [#{level}]: #{name} } + %q{#{frame ? '('+frame+')' : ''}: #{msg[0,1024]}}"
Generated with the Darkfish Rdoc Generator.