Sha256: b22f2c424ba7591e3a3269620024ef0c89091813b5d8a6acd6a7f2e583d07576

Contents?: true

Size: 662 Bytes

Versions: 10

Compression:

Stored size: 662 Bytes

Contents

module ActiveRecord
  module SqlAnalyzer
    class Logger
      attr_reader :log_file, :log_prefix, :log_root, :config

      def initialize(log_root, log_prefix)
        @log_prefix = log_prefix
        @log_root = log_root
        @config = SqlAnalyzer.config

        @log_file = File.open("#{log_root}/#{log_prefix}.log", "a")
      end

      # Log the raw event data directly to disk
      def log(event)
        log_file.puts(event.to_json)
      end

      # Further redact or remove any other information from an event
      def filter_event(event)
        event
      end

      def close
        @log_file.close rescue nil
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
active_record-sql_analyzer-0.3.0 lib/active_record/sql_analyzer/logger.rb
active_record-sql_analyzer-0.2.3 lib/active_record/sql_analyzer/logger.rb
active_record-sql_analyzer-0.2.2 lib/active_record/sql_analyzer/logger.rb
active_record-sql_analyzer-0.2.1 lib/active_record/sql_analyzer/logger.rb
active_record-sql_analyzer-0.2.0 lib/active_record/sql_analyzer/logger.rb
active_record-sql_analyzer-0.1.0 lib/active_record/sql_analyzer/logger.rb
active_record-sql_analyzer-0.0.8 lib/active_record/sql_analyzer/logger.rb
active_record-sql_analyzer-0.0.7 lib/active_record/sql_analyzer/logger.rb
active_record-sql_analyzer-0.0.6 lib/active_record/sql_analyzer/logger.rb
active_record-sql_analyzer-0.0.5 lib/active_record/sql_analyzer/logger.rb