]>
git.r.bdr.sh - rbdr/cologne/blob - lib/cobalt.rb
9 attr_accessor
:keep_in_buffer, :separator_length
11 def initialize( options
= {} )
13 @loggers = options
[:loggers] || [::Logger.new(STDOUT)]
14 @keep_in_buffer = false
16 @separator_length = 120
24 def remove_logger logger
25 @loggers = @loggers - [logger
]
29 @keep_in_buffer = false
30 @temporal_buffer.each
do |line
|
31 @loggers.each
{ |logger
| logger
.info(line
) }
38 objects
.each
do |object
|
40 the_string
= object
.to_s
41 the_string
= the_string
.to_ansi
.send(@color).to_s
42 the_string
= the_string
.gsub(/^/, ' ' * @indent)
44 @loggers.each
do |logger
|
46 @temporal_buffer << the_string
49 logger
.info the_string
61 PP
.pp(objects
.first
, dump
)
67 color(:cyan) { log(*objects
) }
71 color(:yellow) { log(*objects
) }
75 color(:red) { log(*objects
) }
78 def separator(type
= '-')
79 log((type
* (@separator_length - @indent)))
83 lines
.times
{ self.log('') }