class Ey::Core::Cli::Logs
Public Instance Methods
handle()
click to toggle source
# File lib/ey-core/cli/logs.rb, line 33 def handle operator, environment = core_operator_and_environment_for(options) abort "Unable to find matching environment".red unless environment servers = if option(:server) if option(:server).match(/i-/) environment.servers.all(provisioned_id: option(:server)) else [environment.servers.get(option(:server))].compact end else environment.servers.all end abort "No servers found".red if servers.empty? servers.each do |server| name = [server.provisioned_id, server.name, server.role].compact.join(" ") if main_log = server.latest_main_log puts "Main logs for #{name}:".green puts main_log.contents if custom_log = server.latest_custom_log #only older stack versions will have custom logs at all, so to avoid showing in-accurate logs, ensure the latest custom log is created (run) chronologically after the latest main log if main_log.created_at < custom_log.created_at puts "Custom logs for #{name}:".green puts custom_log.contents end end else puts "No Logs".yellow end end end