Sha256: 199cf5c797ee7d7dda02d6f42b014d3390294502c9f34d9148a247adcb9a32af

Contents?: true

Size: 656 Bytes

Versions: 5

Compression:

Stored size: 656 Bytes

Contents

require 'log4r/formatter/patternformatter'

module Log4r
  class PapertrailOutputter < RemoteSyslogOutputter
    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
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
naf-1.1.4 app/models/log4r/papertrail_outputter.rb
naf-1.1.3 app/models/log4r/papertrail_outputter.rb
naf-1.1.2 app/models/log4r/papertrail_outputter.rb
naf-1.1.1 app/models/log4r/papertrail_outputter.rb
naf-1.1.0 app/models/log4r/papertrail_outputter.rb