module RLogger
Constants
- VERSION
Public Class Methods
make(log_file)
click to toggle source
# File lib/r_logger.rb, line 7 def make(log_file) @logger ||= {} log_file_name = if log_file.class.in? [String, Symbol] log_file_name = log_file.to_sym unless log_file_name.to_s.end_with? ".log" log_file_name = "#{log_file_name}.log" end "#{root_path}/#{log_file_name}" elsif log_file.respond_to? :to_path log_file.to_path else raise Exceptions::UnsupportdParamType.new("log file parameter only support 'File' or 'String' Type.") end # 如果已经存在日志对象,则返回已有的日志对象 @logger[log_file_name] ||= ::Logger.new(log_file_name) end
root_path()
click to toggle source
# File lib/r_logger.rb, line 28 def root_path @root ||= "#{Rails.root}/log" end