Class: Log4r::PapertrailOutputter

Inherits:
RemoteSyslogOutputter
  • Object
show all
Defined in:
app/models/log4r/papertrail_outputter.rb

Instance Method Summary collapse

Constructor Details

#initialize(name, options) ⇒ PapertrailOutputter

Returns a new instance of PapertrailOutputter.



5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'app/models/log4r/papertrail_outputter.rb', line 5

def initialize(name, options)
  cloned_options = options.clone
  unless cloned_options.has_key?('url')
    if cloned_options.has_key?('port')
      cloned_options['url'] = "syslog://logs.papertrailapp.com:#{cloned_options['port']}"
    end
  end
  if cloned_options.has_key?('program')
    program_formatter = Log4r::PatternFormatter.new('pattern' => cloned_options['program'])
    cloned_options['program'] = program_formatter.format("").chomp
  end
  super(name, cloned_options)
end