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.

Instance Attribute Summary

Attributes inherited from Receiver

#mutex

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.



14
15
16
17
18
19
20
# File 'lib/multi_process/logger.rb', line 14

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

  super()
end

Class Method Details

.globalObject



69
70
71
# File 'lib/multi_process/logger.rb', line 69

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