Class: RubySupervisor::ProcessLogsProxy

Inherits:
NamedProxy show all
Defined in:
lib/ruby-supervisor/api/process_logs.rb

Instance Attribute Summary

Attributes inherited from NamedProxy

#name

Instance Method Summary collapse

Methods inherited from NamedProxy

#initialize

Methods inherited from Proxy

#initialize

Constructor Details

This class inherits a constructor from RubySupervisor::NamedProxy

Instance Method Details

#clearObject

Clear the logs and reopen them, both stderr and stdout logs will be cleared.



17
18
19
# File 'lib/ruby-supervisor/api/process_logs.rb', line 17

def clear
  request('clearProcessLogs', @name)
end

#read(offset, length, what = :stdout) ⇒ String

Read chunk of logs for this process.

Parameters:

  • offset (Integer)

    where to start from

  • length (Integer)

    How many bytes to read

  • what (Symbol) (defaults to: :stdout)

    :stdout or :stderr

Returns:

  • (String)

    Log data



30
31
32
33
34
35
36
37
38
39
# File 'lib/ruby-supervisor/api/process_logs.rb', line 30

def read(offset, length, what = :stdout)
  case what
  when :stdout  then  call = 'readProcessStdoutLog'
  when :stderr  then  call = 'readProcessStderrLog'
  else
    raise "invalid value for what parameter: #{what}"
  end
  
  request(call, @name, offset, length)
end

#tail(offset, length, what = :stdout) ⇒ Array

Tail chunk of logs for this process.

What is the real difference between read and tail ? I have currently no idea ! documentation is rather… vague.

Parameters:

  • offset (Integer)

    where to start from

  • length (Integer)

    How many bytes to read

  • what (Symbol) (defaults to: :stdout)

    :stdout or :stderr

Returns:

  • (Array)
    bytes read, offset, overflow


54
55
56
57
58
59
60
61
62
63
# File 'lib/ruby-supervisor/api/process_logs.rb', line 54

def tail(offset, length, what = :stdout)
  case what
  when :stdout  then  call = 'tailProcessStdoutLog'
  when :stderr  then  call = 'tailProcessStderrLog'
  else
    raise "invalid value for what parameter: #{what}"
  end
  
  request(call, @name, offset, length)
end