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


167
168
169
170
171
# File 'lib/omnibus/logger.rb', line 167

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)

178
179
180
# File 'lib/omnibus/logger.rb', line 178

def <<(data)
  log_lines(data)
end

#inspectString

The detailed string representation of this object.

Returns:

  • (String)

196
197
198
# File 'lib/omnibus/logger.rb', line 196

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

#to_sString

The string representation of this object.

Returns:

  • (String)

187
188
189
# File 'lib/omnibus/logger.rb', line 187

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