class UtilLinuxLogger

UtilLinuxLogger is small utility class intended to be drop in replacement for Syslog. It uses ‘logger` command from util-linux project to provide system logging facilities.

It implements just minimal interface required by ABRT project.

Public Class Methods

new(ident) click to toggle source
# File lib/abrt/util_linux_logger.rb, line 16
def initialize(ident)
  @ident = ident
end
open(ident) click to toggle source

Open the UtilLinuxLoggersyslog facility.

‘ident` is a String which identifies the calling program.

# File lib/abrt/util_linux_logger.rb, line 12
def self.open(ident)
  self.new(ident)
end

Public Instance Methods

err(format_string, *arguments) click to toggle source
# File lib/abrt/util_linux_logger.rb, line 24
def err(format_string, *arguments)
  log 'user.err', format_string, *arguments
end
notice(format_string, *arguments) click to toggle source
# File lib/abrt/util_linux_logger.rb, line 20
def notice(format_string, *arguments)
  log 'user.notice', format_string, *arguments
end

Private Instance Methods

log(priority, format_string, *arguments) click to toggle source
# File lib/abrt/util_linux_logger.rb, line 29
def log(priority, format_string, *arguments)
  IO.popen "logger -p #{priority} -t #{@ident} --socket-errors=off", 'w' do |io|
    io.write sprintf(format_string, *arguments)
  end
end