module Rack::SimpleAuth::Logger
class Logger
This class receives a logpath, env and message and prints the message to the specified logpath for the proper env file (eg.: /path/to/file/test_error.log for test env)
Public Class Methods
log(logpath, verbose, env, msg)
click to toggle source
Create Logfile
@param [String] logpath [path to logfile] @param [TrueClass|FalseClass] verbose [if true print to stdout] @param [String] msg [Message defined by each Authorization class]
# File lib/rack/simple_auth/logger.rb, line 13 def self.log(logpath, verbose, env, msg) if logpath system("mkdir #{logpath}") unless Dir.exist?("#{logpath}") open("#{logpath}/#{env}_error.log", 'a') do |f| f << "#{msg}\n" end end puts msg if verbose end