Sha256: 5f64716ff7f7cf5519cf5f0286f2bb545f1669bd33c458e73ddaae1475814f90

Contents?: true

Size: 1.05 KB

Versions: 3

Compression:

Stored size: 1.05 KB

Contents

require 'iowa/Logger'
require 'logger'

module Iowa
  module Loggers
    class Logger < Iowa::Logger
      Intervals = {:daily => true, :weekly => true, :monthly => true}

      def open
        log_root = Iowa.config[Clogger].has_key?(Cbasedir) ?
          ( Iowa.config[Clogger][Cbasedir].index('/') == 0 ?
            File.expand_path( Iowa.config[Clogger][Cbasedir] ) :
            File.expand_path( File.join( Iowa::Application.iowa_root, Iowa.config[Clogger][Cbasedir] ) ) ) :
          Iowa::Application.log_root 
        logfile = File.join(log_root, (Iowa.config[Clogger][Cfilename] || 'iowa.log'))
        logargs = []
        if Intervals.has_key?(Iowa.config[Clogger][Cmaxage].to_s.downcase.intern)
          logargs << Iowa.config[Clogger][Cmaxage].to_s.downcase
        else
          maxfiles = Iowa.config[Clogger].has_key?(Cmaxfiles) ? Iowa.config[Clogger][Cmaxfiles] : 10
          logargs << maxfiles
          logargs << Iowa.config[Clogger][Cmaxsize] || 1024 * 1024
        end
        @logger = ::Logger.new(logfile,*logargs)
      end

    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
IOWA-1.0.3 src/iowa/loggers/Logger.rb
IOWA-1.0.2 src/iowa/loggers/Logger.rb
IOWA-1.0.0 src/iowa/loggers/Logger.rb