Class: Log4r::BufferedSyslogOutputter

Inherits:
SyslogOutputter show all
Defined in:
lib/log4r/outputter/bufferedsyslogoutputter.rb

Constant Summary

Constants inherited from SyslogOutputter

SyslogOutputter::SYSLOG_LEVELS_MAP, SyslogOutputter::SYSLOG_LOG4R_MAP

Instance Attribute Summary

Attributes inherited from Outputter

#formatter, #level, #name

Instance Method Summary collapse

Methods inherited from SyslogOutputter

#close, #closed?, #get_levels_map, #map_levels_by_name_to_syslog

Methods inherited from Outputter

[], []=, each, each_outputter, #only_at, stderr, stdout

Constructor Details

#initialize(*args) ⇒ BufferedSyslogOutputter

Returns a new instance of BufferedSyslogOutputter.



6
7
8
9
# File 'lib/log4r/outputter/bufferedsyslogoutputter.rb', line 6

def initialize(*args)
  super
  @buff = {}
end

Instance Method Details

#flushObject



11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/log4r/outputter/bufferedsyslogoutputter.rb', line 11

def flush
  synch do
    begin
      @buff.each do |pri, message|
        Syslog.open(@ident, @logopt, @facility) do |s|
          s.log(pri, '%s', message.join("\t"))
        end
      end
    ensure
      @buff.clear
    end
  end
end