class Treefell::DebugLogger
Constants
- DEFAULT_FILTER_PROC
Attributes
filter[R]
io[R]
namespace[R]
Public Class Methods
new(namespace: nil, io: $stdout, color: Color.rotate, filter: nil)
click to toggle source
# File lib/treefell/debug_logger.rb, line 8 def initialize(namespace: nil, io: $stdout, color: Color.rotate, filter: nil) @namespace = namespace @io = io @color = color @filter = filter || DEFAULT_FILTER_PROC end
Public Instance Methods
==(other)
click to toggle source
# File lib/treefell/debug_logger.rb, line 36 def ==(other) other.is_a?(self.class) && other.namespace == namespace && other.io == io && other.filter == filter end
[](sub_namespace)
click to toggle source
# File lib/treefell/debug_logger.rb, line 15 def [](sub_namespace) @debug_loggers ||= {} @debug_loggers[sub_namespace] ||= DebugLogger.new( namespace: sub_namespace, io: self, filter: DEFAULT_FILTER_PROC ) end
puts(message)
click to toggle source
# File lib/treefell/debug_logger.rb, line 24 def puts(message) if @filter.call(namespace, message) formatted_namespace = if namespace @color.colorize(namespace) end @io.puts [ formatted_namespace, message ].compact.join(' ') end end