Sha256: c96cbbfdc431f87764cc1ece0915179346db9b590e18a90a7f363b8b18eaff87

Contents?: true

Size: 643 Bytes

Versions: 5

Compression:

Stored size: 643 Bytes

Contents

require 'syslog'
require 'logging'
require 'logsly/base_output'

module Logsly

  class SyslogOutput < BaseOutput
    def to_appender(*args)
      Syslog.close if Syslog.opened?

      data = SyslogOutputData.new(*args, &self.build)
      Logging.appenders.syslog(data.identity, {
        :logopt   => data.log_opts,
        :facility => data.facility,
        :layout   => self.to_layout(data)
      })
    end
  end

  class SyslogOutputData < BaseOutputData
    option :identity, String
    option :log_opts, Integer, :default => (Syslog::LOG_PID | Syslog::LOG_CONS)
    option :facility, Integer, :default => Syslog::LOG_LOCAL0
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
logsly-1.1.0 lib/logsly/syslog_output.rb
logsly-1.0.2 lib/logsly/syslog_output.rb
logsly-1.0.1 lib/logsly/syslog_output.rb
logsly-1.0.0 lib/logsly/syslog_output.rb
logsly-1.0.0.rc1 lib/logsly/syslog_output.rb