class AWS::CloudFormation::Helper::Logger

Main class to handle logging

Constants

DEFAULT_LOG_LEVEL

docs.aws.amazon.com/lambda/latest/dg/ruby-logging.html

Attributes

log_level[RW]
stderr[RW]
stdout[RW]

Public Class Methods

new(log_level = nil, stdout = STDOUT, stderr = STDERR) click to toggle source
# File lib/aws_cloudformation_helper/logger.rb, line 17
def initialize(log_level = nil, stdout = STDOUT, stderr = STDERR)
  @log_level = DEFAULT_LOG_LEVEL
  @log_level = log_level unless log_level.nil?
  @stdout = stdout
  @stderr = stderr
end

Public Instance Methods

debug(msg) click to toggle source
# File lib/aws_cloudformation_helper/logger.rb, line 36
def debug(msg)
  logger.debug(msg)
end
error(msg) click to toggle source
# File lib/aws_cloudformation_helper/logger.rb, line 24
def error(msg)
  error_logger.error(msg)
end
info(msg) click to toggle source
# File lib/aws_cloudformation_helper/logger.rb, line 28
def info(msg)
  logger.info(msg)
end
warn(msg) click to toggle source
# File lib/aws_cloudformation_helper/logger.rb, line 32
def warn(msg)
  logger.warn(msg)
end

Private Instance Methods

error_logger() click to toggle source
# File lib/aws_cloudformation_helper/logger.rb, line 48
def error_logger
  @logger ||= ::Logger.new(@stderr)
  @logger.level = @log_level
  @logger
end
logger() click to toggle source
# File lib/aws_cloudformation_helper/logger.rb, line 42
def logger
  @logger ||= ::Logger.new(@stdout)
  @logger.level = @log_level
  @logger
end