diff options
author | knu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2002-02-25 12:13:30 +0000 |
---|---|---|
committer | knu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2002-02-25 12:13:30 +0000 |
commit | b700e189bd60f68de89d5785f57edf84588b0a4a (patch) | |
tree | 19133196a9ff2f032a30f43d189a3aabacaadb2e /ext/syslog/syslog.txt | |
parent | 959a99078ea3494fc5ae57b05579b4a2a21fc993 (diff) | |
download | ruby-b700e189bd60f68de89d5785f57edf84588b0a4a.tar.gz |
* ext/syslog/syslog.c: Merge from rough. Turn Syslog into a
module keeping backward compatibility intact.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2134 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/syslog/syslog.txt')
-rw-r--r-- | ext/syslog/syslog.txt | 81 |
1 files changed, 39 insertions, 42 deletions
diff --git a/ext/syslog/syslog.txt b/ext/syslog/syslog.txt index d9dcfc4315..9aed35133d 100644 --- a/ext/syslog/syslog.txt +++ b/ext/syslog/syslog.txt @@ -1,5 +1,5 @@ .\" syslog.txt - -*- Indented-Text -*- -$RoughId: syslog.txt,v 1.15 2001/11/25 21:21:23 knu Exp $ +$RoughId: syslog.txt,v 1.18 2002/02/25 08:20:14 knu Exp $ $Id$ UNIX Syslog extension for Ruby @@ -9,11 +9,9 @@ Amos Gouaux, University of Texas at Dallas Akinori MUSHA <knu@ruby-lang.org> -** Syslog(Class) +** Syslog(Module) -Superclass: Object - -Mix-ins: Syslog::Constants +Included Modules: Syslog::Constants require 'syslog' @@ -22,39 +20,18 @@ if you're writing a server in Ruby. For the details of the syslog(8) architecture and constants, see the syslog(3) manual page of your platform. -Class Methods: +Module Methods: open(ident = $0, logopt = Syslog::LOG_PID | Syslog::LOG_CONS, facility = Syslog::LOG_USER) [{ |syslog| ... }] - Opens syslog with the given options and returns the singleton - object of the Syslog class. If a block is given, calls it - with an argument of the object. If syslog is already opened, - raises RuntimeError. + Opens syslog with the given options and returns the module + itself. If a block is given, calls it with an argument of + itself. If syslog is already opened, raises RuntimeError. Example: - sl = Syslog.open('ftpd', Syslog::LOG_PID | Syslog::LOG_NDELAY, - Syslog::LOG_FTP) - - instance - - Returns the singleton object. - - LOG_MASK(pri) - - Creates a mask for one priority. - - LOG_UPTO(pri) - - Creates a mask for all priorities up to pri. - -Methods: - - open(ident = $0, logopt = Syslog::LOG_PID | Syslog::LOG_CONS, - facility = Syslog::LOG_USER) - - Opens syslog with the given options. If syslog is already - opened, raises RuntimeError. + Syslog.open('ftpd', Syslog::LOG_PID | Syslog::LOG_NDELAY, + Syslog::LOG_FTP) open!(ident = $0, logopt = Syslog::LOG_PID | Syslog::LOG_CONS, facility = Syslog::LOG_USER) @@ -72,14 +49,14 @@ Methods: facility Returns the parameters given in the last open, respectively. - Every call of Syslog::open/Syslog#open resets those values. + Every call of Syslog::open resets these values. log(pri, message, ...) Writes message to syslog. Example: - sl.log(Syslog::LOG_CRIT, "the sky is falling in %d seconds!", 10) + Syslog.log(Syslog::LOG_CRIT, "the sky is falling in %d seconds!", 10) crit(message, ...) emerg(message, ...) @@ -90,21 +67,21 @@ Methods: info(message, ...) debug(message, ...) - These are shortcut methods of Syslog#log(). The Lineup may + These are shortcut methods of Syslog::log(). The lineup may vary depending on what priorities are defined on your system. Example: - sl.crit("the sky is falling in %d seconds!",5) + Syslog.crit("the sky is falling in %d seconds!", 5) mask mask=(mask) Returns or sets the log priority mask. The value of the mask - is persistent and Syslog::open/Syslog#open/Syslog#close don't - reset it. + is persistent and will not be reset by Syslog::open or + Syslog::close. Example: - sl.mask = Syslog::LOG_UPTO(Syslog::LOG_ERR) + Syslog.mask = Syslog::LOG_UPTO(Syslog::LOG_ERR) close @@ -112,13 +89,33 @@ Methods: inspect - Returns the "inspect" string of the object. + Returns the "inspect" string of the Syslog module. -** Syslog::Constants(Module) + instance -Superclass: Object + Returns the module itself. (Just for backward compatibility) + + LOG_MASK(pri) + + Creates a mask for one priority. + + LOG_UPTO(pri) + + Creates a mask for all priorities up to pri. + +** Syslog::Constants(Module) require 'syslog' include Syslog::Constants This module includes the LOG_* constants available on the system. + +Module Methods: + + LOG_MASK(pri) + + Creates a mask for one priority. + + LOG_UPTO(pri) + + Creates a mask for all priorities up to pri. |