Sha256: 50f3d53f468ca41d1b6578f1e5f6253add609329fe4e99fb4c3808dc99b6b922
Contents?: true
Size: 1.33 KB
Versions: 3
Compression:
Stored size: 1.33 KB
Contents
# frozen_string_literal: true require 'kubernetes-deploy/container_logs' module KubernetesDeploy class RemoteLogs attr_reader :container_logs def initialize(logger:, parent_id:, container_names:, namespace:, context:) @logger = logger @parent_id = parent_id @container_logs = container_names.map do |n| ContainerLogs.new( logger: logger, container_name: n, parent_id: parent_id, namespace: namespace, context: context ) end end def empty? @container_logs.all?(&:empty?) end def sync @container_logs.each(&:sync) end def print_latest @container_logs.each { |cl| cl.print_latest(prefix: @container_logs.length > 1) } end def print_all(prevent_duplicate: true) return if @already_displayed && prevent_duplicate if @container_logs.all?(&:empty?) @logger.warn("No logs found for #{@parent_id}") return end @container_logs.each do |cl| if cl.empty? @logger.warn("No logs found for #{@parent_id} container '#{cl.container_name}'") else @logger.info("Logs from #{@parent_id} container '#{cl.container_name}':") cl.print_all @logger.blank_line end end @already_displayed = true end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
kubernetes-deploy-0.25.0 | lib/kubernetes-deploy/remote_logs.rb |
kubernetes-deploy-0.24.0 | lib/kubernetes-deploy/remote_logs.rb |
kubernetes-deploy-0.23.0 | lib/kubernetes-deploy/remote_logs.rb |