Sha256: e149c87a0e5f4607f0ad5f2a9ba2220e25849454cc1282fba29831012d8dc19b
Contents?: true
Size: 657 Bytes
Versions: 3
Compression:
Stored size: 657 Bytes
Contents
require "mkit/cmd/shell_client" module MKIt class DockerLogListener < MKIt::ShellClient def initialize(pod, ws, options: {}) @pod = pod @ws = ws command = "docker logs" command += " -f" if options[:follow] == 'true' command += " -n #{options[:nr_lines]}" if options[:nr_lines] command += " -n 10" unless options[:nr_lines] command += " #{@pod.name}" super(command: command) end def register super do |stdout, stdin, pid| stdout.each { |line| @ws.send(line.strip!) } end end def close @ws.close_websocket unless @ws.nil? end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
mkit-0.9.0 | lib/mkit/pods/docker_log_listener.rb |
mkit-0.8.0 | lib/mkit/pods/docker_log_listener.rb |
mkit-0.7.2 | lib/mkit/docker_log_listener.rb |