Sha256: 60fa780581a7a455844e9d2a094177dd59c323c1a9d91f9bffbb5614b99f9dc6

Contents?: true

Size: 1019 Bytes

Versions: 5

Compression:

Stored size: 1019 Bytes

Contents

require 'logger'

module LogStasher
  class << self
    attr_reader :append_fields_callback
    attr_writer :enabled
    attr_writer :include_parameters
    attr_writer :silence_standard_logging

    def append_fields(&block)
      @append_fields_callback = block
    end

    def enabled?
      if @enabled.nil?
        @enabled = false
      end

      @enabled
    end

    def include_parameters?
      if @include_parameters.nil?
        @include_parameters = true
      end

      @include_parameters
    end

    def initialize_logger(device = $stdout, level = ::Logger::INFO)
      ::Logger.new(device).tap do |new_logger|
        new_logger.level = level
      end
    end

    def logger
      @logger ||= initialize_logger
    end

    def logger=(log)
      @logger = log
    end

    def silence_standard_logging?
      if @silence_standard_logging.nil?
        @silence_standard_logging = false
      end

      @silence_standard_logging
    end
  end
end

require 'logstasher/railtie' if defined?(Rails)

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
md-logstasher-1.0.0 lib/logstasher.rb
md-logstasher-1.0.0.rc5 lib/logstasher.rb
md-logstasher-1.0.0.rc4 lib/logstasher.rb
md-logstasher-1.0.0.rc3 lib/logstasher.rb
md-logstasher-1.0.0.rc2 lib/logstasher.rb