class MiniProgram::RLogger
Public Class Methods
make(log_file)
click to toggle source
# File lib/r_logger.rb, line 8 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
new()
click to toggle source
# File lib/r_logger.rb, line 3 def initialize raise Exceptions::InitializeDenied.new("please use 'ILogger.make' instead of 'ILogger.new'") end
root_path()
click to toggle source
# File lib/r_logger.rb, line 29 def root_path @root ||= "#{Rails.root}/log" end