Sha256: 6492bbe4f9ca19e81fa2fc984b85e933d47613ce1dbbe3c6bf6cb4b11d0a5548
Contents?: true
Size: 1.06 KB
Versions: 2
Compression:
Stored size: 1.06 KB
Contents
require 'syslog/logger' module Logatron class << self attr_accessor :configuration end def self.configure self.configuration ||= Configuration.new yield(configuration) end class Configuration attr_accessor :logger, :host, :level, :transformer attr_reader :loggable_levels, :backtrace_cleaner def initialize @logger = Syslog::Logger.new('ascent') @transformer = proc {|x| x.to_json} @host = `hostname`.chomp @level = INFO levels = [DEBUG, INFO, WARN, ERROR, CRITICAL, FATAL] @loggable_levels = levels.slice(levels.index(@level), levels.size-1) 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.1.2 | lib/logatron/configuration.rb |
logatron-0.1.1 | lib/logatron/configuration.rb |