Sha256: f1d96ca3d09e3d7f07e7da756e8594b5895338bb9a35678eb7a68380a6ca3567

Contents?: true

Size: 1.02 KB

Versions: 2

Compression:

Stored size: 1.02 KB

Contents

module OhMyLog
  module Log
    class Configuration
      attr_accessor :models, :print_log, :record_history, :log_instance, :syslog
      attr_reader :selectors, :log_path

      def initialize(*args)
        @selectors = []
        #models not to track
        @models = {"ALL" => []}
        @print_log = true
        @log_instance = Logger.new(File.join(Rails.root, 'log/oh_my_log.log')) unless @log_path
        @log_path = nil
        @syslog = nil
        #do we wanna keep track of all the actions?
        @record_history = false
      end

      def add_selector(selector)
        @selectors << selector
      end

      def reset_selectors
        @selectors = []
      end

      def log_path=(path)
        @log_path = path
        process_path
      end

      def get_actions(controller)
        @selectors.each do |selector|
          return selector.actions if selector.controller == controller
        end
      end

      def process_path
        @log_instance = Logger.new(@log_path) if (@log_path)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
oh_my_log-1.0.4 lib/oh_my_log/configuration.rb
oh_my_log-1.0.3 lib/oh_my_log/configuration.rb