Module: CfnBackup::Log

Included in:
Generate, Publish, Utils
Defined in:
lib/cfnbackup/log.rb

Class Method Summary collapse

Class Method Details

.colorsObject



6
7
8
9
10
11
12
13
# File 'lib/cfnbackup/log.rb', line 6

def self.colors
  @colors ||= {
    ERROR: 31, # Red
    WARN: 33, # Yellow
    DEBUG: 32, # Green
    INFO: 0
  }
end

.loggerObject



15
16
17
18
19
20
21
22
23
24
# File 'lib/cfnbackup/log.rb', line 15

def self.logger
  if @logger.nil?
    @logger = Logger.new(STDOUT)
    @logger.level = Logger::INFO
    @logger.formatter = proc do |severity, datetime, progname, msg|
      "\e[#{colors[severity.to_sym]}m#{severity}: - #{msg}\e[0m\n"
    end
  end
  @logger
end

.logger=(logger) ⇒ Object



26
27
28
# File 'lib/cfnbackup/log.rb', line 26

def self.logger=(logger)
  @logger = logger
end