Class: MultiProcess::Logger

Inherits:
Receiver show all
Defined in:
lib/multi_process/logger.rb

Overview

Can create pipes and multiplex pipe content to put into given IO objects e.g. multiple output from multiple processes to current stdout.

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Receiver

#message, #pipe

Constructor Details

#initialize(*args) ⇒ Logger

Create new logger.

Parameters:

  • out (IO)

    IO to push formatted output from default created logger pipes.

  • err (IO)

    IO to push formatted output from error sources.



16
17
18
19
20
21
22
23
24
# File 'lib/multi_process/logger.rb', line 16

def initialize(*args)
  @opts  = args.last.is_a?(Hash) ? args.pop : {}
  @out   = args[0] || $stdout
  @err   = args[1] || $stderr

  @colwidth = 0

  super()
end

Class Method Details

.globalObject



76
77
78
# File 'lib/multi_process/logger.rb', line 76

def global
  @global ||= new $stdout, $stderr
end