class Shelly::CLI::Logs
Public Instance Methods
get(date = "today")
click to toggle source
# File lib/shelly/cli/logs.rb, line 36 def get(date = "today") app = multiple_clouds(options[:cloud], "logs get #{date}") attributes = app.download_application_logs_attributes({:date => date}) bar = Shelly::DownloadProgressBar.new app.download_application_logs(attributes, bar.progress_callback) bar.finish say_new_line say "Log file saved to #{attributes["filename"]}", :green rescue Client::NotFoundException => e bar.clear say_error "Log file for #{date} not found", :with_exit => false rescue Client::ValidationException => e e.each_error { |error| say_error error, :with_exit => false } end
latest()
click to toggle source
# File lib/shelly/cli/logs.rb, line 17 def latest app = multiple_clouds(options[:cloud], "logs latest") limit = options[:limit].to_i <= 0 ? 100 : options[:limit] query = {:limit => options[:limit], :source => options[:source]} query.merge!(:from => options[:from]) if options[:from] logs = app.application_logs(query) print_logs(logs) if options[:tail] app.application_logs_tail { |logs| print logs } end rescue Client::APIException => e raise e unless e.status_code == 416 say_error "You have requested too many log messages. Try a lower number." end