Class: Ey::Core::Cli::Logs
- Inherits:
-
Subcommand
- Object
- Belafonte::App
- Subcommand
- Ey::Core::Cli::Logs
- Defined in:
- lib/ey-core/cli/logs.rb
Instance Method Summary collapse
Methods inherited from Subcommand
#handle_core_error, #run_handle, #setup
Methods included from Helpers::Core
#core_account, #core_accounts, #core_application_for, #core_applications, #core_client, #core_environment_for, #core_environment_variables, #core_environments, #core_operator_and_environment_for, #core_server_for, #core_url, #core_yaml, #eyrc_yaml, included, #longest_length_by_name, #operator, #unauthenticated_core_client, #write_core_yaml
Instance Method Details
#handle ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/ey-core/cli/logs.rb', line 33 def handle operator, environment = core_operator_and_environment_for() 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 |