Sha256: 3d318c7d08f56e00a23e43a6e50407a149a4007ed927f650ccb73d41c556fd8e
Contents?: true
Size: 605 Bytes
Versions: 2
Compression:
Stored size: 605 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 += " #{@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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
mkit-0.7.1 | lib/mkit/docker_log_listener.rb |
mkit-0.7.0 | lib/mkit/docker_log_listener.rb |