Class: Ramaze::Logger::Syslog

Inherits:
Object
  • Object
show all
Includes:
Ramaze::Logging
Defined in:
lib/ramaze/log/syslog.rb

Overview

Logger class for writing to syslog. It is a very thin wrapper around the Syslog library.

Since:

Instance Method Summary (collapse)

Methods included from Ramaze::Logging

#debug, #debug?, #dev, #error, #info, #shutdown, #tag_log, #warn

Constructor Details

- (Syslog) initialize(*args)

Open the syslog library, if it is allready open, we reopen it using the new argument list. The argument list is passed on to the Syslog library so please check that, and man syslog for detailed information. There are 3 parameters:

ident:  The identification used in the log file, defaults to $0
options:  defaults to  Syslog::LOG_PID | Syslog::LOG_CONS
facility: defaults to Syslog::LOG_USER

Since:

  • 11-08-2009



34
35
36
37
# File 'lib/ramaze/log/syslog.rb', line 34

def initialize( *args )
  ::Syslog.close if ::Syslog.opened?
  ::Syslog.open( *args )
end

Instance Method Details

- (Object) inspect

Has to call the modules singleton-method.

Since:

  • 11-08-2009



52
53
54
# File 'lib/ramaze/log/syslog.rb', line 52

def inspect
  ::Syslog.inspect
end

- (Object) log(tag, *messages)

Just sends all messages received to ::Syslog We simply return if the log was closed for some reason, this behavior was copied from Informer. We do not handle levels here. This will be done by te syslog daemon based on it's configuration.

Since:

  • 11-08-2009



44
45
46
47
# File 'lib/ramaze/log/syslog.rb', line 44

def log(tag, *messages)
  return if !::Syslog.opened?
  ::Syslog.send(tag, *messages)
end