Type:
Class
Constants:
VERSION : '2.0'

The version of Syslog::Logger you are using.

LEVEL_MAP : { ::Logger::UNKNOWN => Syslog::LOG_ALERT, ::Logger::FATAL => Syslog::LOG_ERR, ::Logger::ERROR => Syslog::LOG_WARNING, ::Logger::WARN => Syslog::LOG_NOTICE, ::Logger::INFO => Syslog::LOG_INFO, ::Logger::DEBUG => Syslog::LOG_DEBUG, }

Maps Logger warning types to syslog(3) warning types.

Messages from ruby applications are not considered as critical as messages from other system daemons using syslog(3), so most messages are reduced by one level. For example, a fatal message for ruby's Logger is considered an error for syslog(3).

Syslog::Logger is a Logger work-alike that logs via syslog instead of to a file. You can use Syslog::Logger to aggregate logs between multiple machines.

By default, Syslog::Logger uses the program name 'ruby', but this can be changed via the first argument to ::new.

NOTE! You can only set the Syslog::Logger program name when you initialize Syslog::Logger for the first time. This is a limitation of the way Syslog::Logger uses syslog (and in some ways, a limitation of the way syslog(3) works). Attempts to change Syslog::Logger's program name after the first initialization will be ignored.

Example

The following will log to syslogd on your local machine:

require 'syslog/logger'

log = Syslog::Logger.new 'my_program'
log.info 'this line will be logged via syslog(3)'

You may need to perform some syslog.conf setup first. For a BSD machine add the following lines to /etc/syslog.conf:

!my_program
*.*                                             /var/log/my_program.log

Then touch /var/log/my_program.log and signal syslogd with a HUP (killall -HUP syslogd, on FreeBSD).

If you wish to have logs automatically roll over and archive, see the newsyslog.conf(5) and newsyslog(8) man pages.

error

error Instance Public methods Logs a message at the error (syslog

2015-05-16 15:54:15
add

add(severity, message = nil, progname = nil, &block) Instance Public methods Almost

2015-05-16 15:44:11
warn

warn Instance Public methods Logs a message at the warn (syslog

2015-05-16 16:15:49
syslog=

syslog=(syslog) Class Public methods Specifies the internal

2015-05-16 15:40:26
syslog

syslog() Class Public methods Returns the internal

2015-05-16 15:35:08
unknown

unknown Instance Public methods Logs a message at the unknown (syslog

2015-05-16 16:11:33
make_methods

make_methods(meth) Class Public methods Builds a methods for level meth

2015-05-16 15:26:24
fatal

fatal Instance Public methods Logs a message at the fatal (syslog

2015-05-16 16:00:43
debug

debug Instance Public methods Logs a message at the debug (syslog

2015-05-16 15:48:45
new

new(program_name = 'ruby') Class Public methods Fills in variables for

2015-05-16 15:30:24