Module: Cuporter::Logging

Extended by:
Logging
Included in:
Logging
Defined in:
lib/cuporter/logging.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#output_homeObject

Returns the value of attribute output_home.



10
11
12
# File 'lib/cuporter/logging.rb', line 10

def output_home
  @output_home
end

Instance Method Details

#error_log_fileObject



24
25
26
# File 'lib/cuporter/logging.rb', line 24

def error_log_file
  File.open(File.join(output_home || '.', 'cuporter_errors.log'), 'a')
end

#error_loggerObject



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/cuporter/logging.rb', line 12

def error_logger
  @error_logger ||= begin
                     require "logger"
                     logger = ::Logger.new(error_log_file)
                     logger.level = ::Logger::WARN
                     logger.formatter = proc { |severity, datetime, progname, msg|
                       "#{severity} #{datetime.strftime('%b-%d-%y %H:%M:%S')} #{msg}\n\n"
                     }
                     logger
                   end
end