Class: Logatron::Configuration
- Inherits:
-
Object
- Object
- Logatron::Configuration
- Defined in:
- lib/logatron/configuration.rb
Instance Attribute Summary collapse
-
#backtrace_cleaner ⇒ Object
readonly
Returns the value of attribute backtrace_cleaner.
-
#host ⇒ Object
Returns the value of attribute host.
-
#level ⇒ Object
Returns the value of attribute level.
-
#loggable_levels ⇒ Object
readonly
Returns the value of attribute loggable_levels.
-
#logger ⇒ Object
Returns the value of attribute logger.
-
#transformer ⇒ Object
Returns the value of attribute transformer.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/logatron/configuration.rb', line 27 def initialize @logger = Logger.new(STDOUT) @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 |
Instance Attribute Details
#backtrace_cleaner ⇒ Object (readonly)
Returns the value of attribute backtrace_cleaner.
25 26 27 |
# File 'lib/logatron/configuration.rb', line 25 def backtrace_cleaner @backtrace_cleaner end |
#host ⇒ Object
Returns the value of attribute host.
24 25 26 |
# File 'lib/logatron/configuration.rb', line 24 def host @host end |
#level ⇒ Object
Returns the value of attribute level.
24 25 26 |
# File 'lib/logatron/configuration.rb', line 24 def level @level end |
#loggable_levels ⇒ Object (readonly)
Returns the value of attribute loggable_levels.
25 26 27 |
# File 'lib/logatron/configuration.rb', line 25 def loggable_levels @loggable_levels end |
#logger ⇒ Object
Returns the value of attribute logger.
24 25 26 |
# File 'lib/logatron/configuration.rb', line 24 def logger @logger end |
#transformer ⇒ Object
Returns the value of attribute transformer.
24 25 26 |
# File 'lib/logatron/configuration.rb', line 24 def transformer @transformer end |