Method: VCAP::Logging::Sink::SyslogSink#add_record

Defined in:
lib/vcap/logging/sink/syslog_sink.rb

#add_record(log_record) ⇒ Object

Raises:



57
58
59
60
61
62
63
64
# File 'lib/vcap/logging/sink/syslog_sink.rb', line 57

def add_record(log_record)
  raise UsageError, "You cannot add a record until the sink has been opened" unless @opened
  raise UsageError, "You must supply a formatter" unless @formatter

  message = @formatter.format_record(log_record)
  pri = @log_level_map[log_record.log_level]
  @mutex.synchronize { @syslog.log(pri, '%s', message) }
end