You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
pgfqe6ch8/app/helpers/logger_helper.rb

28 lines
715 B

module LoggerHelper
#输出日志
def OutLogger
#日志输出级别
#Rails.logger.level = Logger::INFO
if(!File.exist?("database"))
Dir.mkdir("database")
end
if(!File.exist?("database/get"))
Dir.mkdir("database/get")
end
if(!File.exist?("database/sql"))
Dir.mkdir("database/sql")
end
if(!File.exist?("database/controller"))
Dir.mkdir("database/controller")
end
Rails.logger = Logger.new("database/get/#{Date.today.to_s}.log", "daily")
ActiveRecord::Base.logger = Logger.new("database/sql/#{Date.today.to_s}.log", "daily")
ActionController::Base.logger = Logger.new("database/controller/#{Date.today.to_s}.log", "daily")
end
end