module MailHandler::Logger
Initializes the logger from config
Custom logger that handles loging through STOUT or to a specified logfile
Public Class Methods
error(args)
click to toggle source
# File lib/logger/logger.rb, line 17 def error(args) str = "\n" str << "ERROR: #{args[:error_type]}\n--\n" if args[:error_type] str << "Error code: #{args[:error_code]}\n--\n" if args[:error_code] str << "Subject: #{args[:subject]}\n--\n" if args[:subject] str << "Trace: #{args[:trace]}\n--\n" if args[:trace] str << "==\n" log str end
log(string)
click to toggle source
# File lib/logger/logger.rb, line 27 def log(string) @logfile ? @logfile.puts(string) : puts(string) end
setup(config)
click to toggle source
# File lib/initializers/logger.rb, line 5 def setup(config) require 'logger/logger' Logger.setup config[:logger] end
success(args)
click to toggle source
# File lib/logger/logger.rb, line 13 def success(args) log "SUCCESS: #{args[:subject]}" end