lib/shelly/cli/main.rb in shelly-0.1.5 vs lib/shelly/cli/main.rb in shelly-0.1.6
- old
+ new
@@ -258,15 +258,20 @@
end
desc "logs", "Show latest application logs"
method_option :cloud, :type => :string, :aliases => "-c", :desc => "Specify cloud"
method_option :limit, :type => :numeric, :aliases => "-n", :desc => "Amount of messages to show"
+ method_option :from, :type => :string, :desc => "Time from which to find the logs"
method_option :tail, :type => :boolean, :aliases => "-f", :desc => "Show new logs automatically"
def logs
cloud = options[:cloud]
app = multiple_clouds(cloud, "logs")
begin
- logs = app.application_logs(:limit => options[:limit])
+ limit = options[:limit].to_i <= 0 ? 100 : options[:limit]
+ query = {:limit => limit}
+ query.merge!(:from => options[:from]) if options[:from]
+
+ logs = app.application_logs(query)
print_logs(logs)
if options[:tail]
loop do
logs = app.application_logs(:from => logs['range']['last'])