Class: Roby::Log::ConsoleLogger
Overview
A logger object which dumps events in a human-readable form to an IO object.
Instance Attribute Summary collapse
-
#columns ⇒ Object
readonly
Returns the value of attribute columns.
-
#io ⇒ Object
readonly
Returns the value of attribute io.
Class Method Summary collapse
- .filter_names(name) ⇒ Object
-
.gen_name(gen) ⇒ Object
Human readable name for event generators.
-
.gen_source(gen) ⇒ Object
Name of an event generator source.
Instance Method Summary collapse
- #arg_to_s(arg) ⇒ Object
-
#initialize(io) ⇒ ConsoleLogger
constructor
A new instance of ConsoleLogger.
- #splat? ⇒ Boolean
Constructor Details
#initialize(io) ⇒ ConsoleLogger
Returns a new instance of ConsoleLogger.
25 26 27 28 |
# File 'lib/roby/log/console.rb', line 25 def initialize(io) @io = io @columns = Hash.new { |h, k| h[k] = Array.new } end |
Instance Attribute Details
#columns ⇒ Object (readonly)
Returns the value of attribute columns.
24 25 26 |
# File 'lib/roby/log/console.rb', line 24 def columns @columns end |
#io ⇒ Object (readonly)
Returns the value of attribute io.
24 25 26 |
# File 'lib/roby/log/console.rb', line 24 def io @io end |
Class Method Details
.filter_names(name) ⇒ Object
8 9 10 |
# File 'lib/roby/log/console.rb', line 8 def self.filter_names(name) name.gsub(/Roby::(?:Genom::)?/, '') end |
.gen_name(gen) ⇒ Object
Human readable name for event generators
18 19 20 21 22 |
# File 'lib/roby/log/console.rb', line 18 def self.gen_name(gen) if gen.respond_to?(:symbol) then "[#{gen.symbol}]" else gen.name end end |
.gen_source(gen) ⇒ Object
Name of an event generator source
12 13 14 15 16 |
# File 'lib/roby/log/console.rb', line 12 def self.gen_source(gen) if gen.respond_to?(:task) then gen.task.name else 'toplevel' end end |
Instance Method Details
#arg_to_s(arg) ⇒ Object
30 31 32 33 34 35 36 37 |
# File 'lib/roby/log/console.rb', line 30 def arg_to_s(arg) case arg when Time then Time.at(arg - @reftime).to_hms when Array then arg.map(&method(:arg_to_s)).to_s when Hash then arg.map { |k, v| [arg_to_s(k), arg_to_s(v)].join(" => ") }.to_s else arg.to_s end end |
#splat? ⇒ Boolean
7 |
# File 'lib/roby/log/console.rb', line 7 def splat?; false end |