module Codacy::Configuration
Public Class Methods
log_file_name()
click to toggle source
# File lib/codacy/configuration.rb, line 29 def self.log_file_name today = Date.today # rails overrides to_s method of Date class # https://github.com/rails/rails/blob/master/activesupport/lib/active_support/core_ext/date/conversions.rb#L52 timestamp = today.respond_to?(:to_default_s) ? today.to_default_s : today.to_s 'codacy-coverage_' + timestamp + '.log' end
logger()
click to toggle source
# File lib/codacy/configuration.rb, line 7 def self.logger logger_info = logger_to_stdout logger_info.level = Logger::INFO logger_debug = ENV["DEBUG_STDOUT"] ? logger_to_stdout : logger_to_file logger_debug.level = Logger::DEBUG log = MultiLogger.new(logger_info, logger_debug) log end
logger_to_file()
click to toggle source
# File lib/codacy/configuration.rb, line 23 def self.logger_to_file log_file_path = self.temp_dir + self.log_file_name log_file = File.open(log_file_path, 'a') Logger.new(log_file) end
logger_to_stdout()
click to toggle source
# File lib/codacy/configuration.rb, line 19 def self.logger_to_stdout Logger.new(STDOUT) end
temp_dir()
click to toggle source
# File lib/codacy/configuration.rb, line 37 def self.temp_dir directory_name = Dir.tmpdir + "/codacy-coverage/" Dir.mkdir(directory_name) unless File.exists?(directory_name) directory_name end