Sha256: 7317e2cea9e0cbccb6d384a3f569a691ed4d85215688927954452da42322a68d
Contents?: true
Size: 823 Bytes
Versions: 41
Compression:
Stored size: 823 Bytes
Contents
module ActiveWrapper class Log attr_reader :base, :log, :logger, :stdout def initialize(options) @base = options[:base] @log = options[:log] @stdout = options[:stdout] return if @log == false FileUtils.mkdir_p("#{base}/log") file = File.open("#{base}/log/#{log}.log", 'a') file.sync = true if stdout @logger = Logger.new($stdout) $stdout.reopen(file) $stderr.reopen(file) else @logger = Logger.new(file) end ActiveRecord::Base.logger = @logger end def clear Dir["#{base}/log/*.log"].each do |file| f = File.open(file, "w") f.close end end def method_missing(method, *args) logger.send(method, *args) end end end
Version data entries
41 entries across 41 versions & 4 rubygems