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_client, #core_environment_for, #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 |
# 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) [environment.servers.get(option(:server))] || environment.servers.all(provisioned_id: option(:server)) else environment.servers.all end abort "No servers found".red if servers.empty? servers.each do |server| name = server.name ? "#{server.name} (#{server.role})" : server.role if log = server.latest_main_log puts "Main logs for #{name}:".green puts log.contents end if log = server.latest_custom_log puts "Custom logs for #{name}:".green puts log.contents end end end |