Class: Polytrix::Logger::LogdevLogger

Inherits:
Logger
  • Object
show all
Defined in:
lib/polytrix/logger.rb

Overview

Internal class which adds a #banner method call that displays the message with a callout arrow.

Direct Known Subclasses

StdoutLogger

Instance Method Summary collapse

Instance Method Details

#<<(msg) ⇒ Object

Dump one or more messages to info.

Parameters:

  • msg (String)

    a message



293
294
295
296
297
298
299
300
301
302
303
# File 'lib/polytrix/logger.rb', line 293

def <<(msg)
  @buffer ||= ''
  lines, _, remainder = msg.rpartition("\n")
  if lines.empty?
    @buffer << remainder
  else
    lines.insert(0, @buffer)
    lines.split("\n").each { |l| format_line(l.chomp) }
    @buffer = ''
  end
end

Log a banner message.

Parameters:

  • msg (String) (defaults to: nil)

    a message



308
309
310
# File 'lib/polytrix/logger.rb', line 308

def banner(msg = nil, &block)
  super_info("-----> #{msg}", &block)
end