Class: Backup::Logger::Syslog

Inherits:
Object
  • Object
show all
Defined in:
lib/backup/logger/syslog.rb

Defined Under Namespace

Classes: Options

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Syslog

Returns a new instance of Syslog.



101
102
103
# File 'lib/backup/logger/syslog.rb', line 101

def initialize(options)
  @options = options
end

Instance Method Details

#log(message) ⇒ Object

Message lines are sent without formatting (timestamp, level), since Syslog will provide it’s own timestamp and priority.



108
109
110
111
112
113
# File 'lib/backup/logger/syslog.rb', line 108

def log(message)
  level = @options.send(message.level)
  ::Syslog.open(@options.ident, @options.options, @options.facility) do |s|
    message.lines.each {|line| s.log(level, '%s', line) }
  end
end