Sha256: 3318d2c6160f79b73afb673bc03348686d02a394e0fb59ee40dab0b3dd48470f
Contents?: true
Size: 961 Bytes
Versions: 7
Compression:
Stored size: 961 Bytes
Contents
module Percheron module Actions class Logs include Base def initialize(container, follow: false) @container = container @follow = follow end def execute! $logger.debug "Showing logs on '#{container.name}' container" display_logs! end private attr_reader :container, :follow alias_method :follow?, :follow def options { stdout: true, stderr: true, timestamps: true, tail: 100 } end def display_logs! if follow? opts = options.merge(follow: true) container.docker_container.streaming_logs(opts) do |stream, chunk| puts "#{stream}: #{chunk}" end else puts container.docker_container.logs(options) end rescue Interrupt nil end end end end
Version data entries
7 entries across 7 versions & 1 rubygems