Sha256: 0b021e8c8d22c0b7156b0183fe5107f3b803b1407ffdf1abedb7e8a5570caab7

Contents?: true

Size: 703 Bytes

Versions: 34

Compression:

Stored size: 703 Bytes

Contents

require_relative '../helpers/log_helper'

module Kontena::Cli::Stacks
  class LogsCommand < Kontena::Command
    include Kontena::Cli::Common
    include Kontena::Cli::GridOptions
    include Kontena::Cli::Helpers::LogHelper

    banner "Shows logs from services in a stack"

    parameter "NAME", "Stack name"

    requires_current_master
    requires_current_master_token

    def execute
      show_logs("stacks/#{current_grid}/#{name}/container_logs") do |log|
        show_log(log)
      end
    end

    def show_log(log)
      color = color_for_container(log['name'])
      prefix = "#{log['created_at']} [#{log['name']}]:".colorize(color)
      puts "#{prefix} #{log['data']}"
    end
  end
end

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
kontena-cli-1.3.5 lib/kontena/cli/stacks/logs_command.rb
kontena-cli-1.3.5.rc1 lib/kontena/cli/stacks/logs_command.rb
kontena-cli-1.4.0.pre6 lib/kontena/cli/stacks/logs_command.rb
kontena-cli-1.4.0.pre5 lib/kontena/cli/stacks/logs_command.rb
kontena-cli-1.4.0.pre4 lib/kontena/cli/stacks/logs_command.rb
kontena-cli-1.4.0.pre3 lib/kontena/cli/stacks/logs_command.rb
kontena-cli-1.4.0.pre2 lib/kontena/cli/stacks/logs_command.rb
kontena-cli-1.4.0.pre1 lib/kontena/cli/stacks/logs_command.rb
kontena-cli-1.3.4 lib/kontena/cli/stacks/logs_command.rb
kontena-cli-1.3.4.rc1 lib/kontena/cli/stacks/logs_command.rb
kontena-cli-1.3.3 lib/kontena/cli/stacks/logs_command.rb
kontena-cli-1.3.3.rc1 lib/kontena/cli/stacks/logs_command.rb
kontena-cli-1.3.2 lib/kontena/cli/stacks/logs_command.rb
kontena-cli-1.3.2.rc2 lib/kontena/cli/stacks/logs_command.rb
kontena-cli-1.3.2.rc1 lib/kontena/cli/stacks/logs_command.rb
kontena-cli-1.3.1 lib/kontena/cli/stacks/logs_command.rb
kontena-cli-1.3.1.rc2 lib/kontena/cli/stacks/logs_command.rb
kontena-cli-1.3.1.rc1 lib/kontena/cli/stacks/logs_command.rb
kontena-cli-1.3.0 lib/kontena/cli/stacks/logs_command.rb
kontena-cli-1.3.0.rc4 lib/kontena/cli/stacks/logs_command.rb