Sha256: a508e06cda1e43647d2994fe4f43e41d5fe3df6e884492d0ca4680793cab8e61
Contents?: true
Size: 1.22 KB
Versions: 2
Compression:
Stored size: 1.22 KB
Contents
require 'logger' require 'logatron/const' require 'logatron/basic_formatter' require 'active_support/backtrace_cleaner' require 'active_support/json' module Logatron class << self def configuration= @configuration = configuration end def configuration @configuration ||= Configuration.new end end def self.configure self.configuration yield(configuration) end class Configuration attr_accessor :logger, :host, :level, :transformer attr_reader :loggable_levels, :backtrace_cleaner def initialize @logger = Logger.new(STDOUT) @transformer = proc {|x| x.to_json} @host = `hostname`.chomp @level = INFO level_threshold = SEVERITY_MAP[@level] levels = Logatron::SEVERITY_MAP.keys @loggable_levels = levels.select{|level| SEVERITY_MAP[level] >= level_threshold} bc = ActiveSupport::BacktraceCleaner.new bc.add_filter { |line| line.gsub(Rails.root.to_s, '') } if defined? Rails bc.add_silencer { |line| line =~ /gems/ } @backtrace_cleaner = bc end def logger=(logger) level = @logger.level @logger = logger @logger.level = level @logger.formatter = Logatron::BasicFormatter.new end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
logatron-0.3.0 | lib/logatron/configuration.rb |
logatron-0.2.6 | lib/logatron/configuration.rb |