Class: Jets::CLI::Logs
- Includes:
- AwsServices::AwsHelpers
- Defined in:
- lib/jets/cli/logs.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods included from AwsServices::AwsHelpers
Methods included from AwsServices
#apigateway, #aws_options, #cfn, #codebuild, #dynamodb, #lambda_client, #logs, #s3, #s3_resource, #sns, #sqs, #ssm, #sts, #wafv2
Methods included from AwsServices::StackStatus
Methods included from AwsServices::GlobalMemoist
Methods inherited from Base
#initialize, #paginate, #paging_params, rescue_api_error
Methods included from Util::Logging
Methods included from Api
Constructor Details
This class inherits a constructor from Jets::CLI::Base
Instance Method Details
#log_group_name ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/jets/cli/logs.rb', line 21 def log_group_name log_group_name = @options[:log_group_name] # can be nil if log_group_name.nil? begin log_group_name = Jets::CLI::Lambda::Lookup.function("controller") # function_name rescue Jets::CLI::Call::Error => e puts "ERROR: #{e.}" abort "Unable to determine log group name by looking it up. Can you double check it?" end end unless log_group_name.include?(Jets.project.namespace) log_group_name = "#{Jets.project.namespace}-#{log_group_name}" end unless log_group_name.include?("aws/lambda") log_group_name = "/aws/lambda/#{log_group_name}" end log_group_name end |
#run ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/jets/cli/logs.rb', line 7 def run = @options.dup # so it can be modified [:log_group_name] = log_group_name [:since] ||= "10m" # by default, start search 10m in the past [:wait_exists_retries] = 60 # 300 seconds = 300 / 5 = 60 retries [:wait_exists_seconds] = 5 verb = [:follow] ? "Tailing" : "Showing" warn "#{verb} logs for #{[:log_group_name]}" tail = AwsLogs::Tail.new() tail.run end |