Class: Omnibus::Logger::LiveStream

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

Overview

This is a magical wrapper around the logger that chunks data to not look like absolute shit.

Instance Method Summary collapse

Constructor Details

#initialize(log, level = :debug) ⇒ LiveStream

Create a new LiveStream logger.

Parameters:

  • log (Logger)

    the logger object responsible for logging

  • level (Symbol) (defaults to: :debug)

    the log level



171
172
173
174
175
# File 'lib/omnibus/logger.rb', line 171

def initialize(log, level = :debug)
  @log = log
  @level = level
  @buffer = ""
end

Instance Method Details

#<<(data) ⇒ Object

The live stream operator must respond to <<.

Parameters:

  • data (String)


182
183
184
# File 'lib/omnibus/logger.rb', line 182

def <<(data)
  log_lines(data)
end

#inspectString

The detailed string representation of this object.

Returns:

  • (String)


200
201
202
# File 'lib/omnibus/logger.rb', line 200

def inspect
  "#<#{self.class.name} level: #{@level}>"
end

#to_sString

The string representation of this object.

Returns:

  • (String)


191
192
193
# File 'lib/omnibus/logger.rb', line 191

def to_s
  "#<#{self.class.name}>"
end