OSDN Git Service

ruby-1.9.1-rc1
[splhack/AndroidRuby.git] / lib / ruby-1.9.1-rc1 / ext / syslog / syslog.txt
1 .\" syslog.txt -  -*- Indented-Text -*-
2 $RoughId: syslog.txt,v 1.18 2002/02/25 08:20:14 knu Exp $
3 $Id: syslog.txt 15821 2008-03-21 12:15:06Z knu $
4
5 UNIX Syslog extension for Ruby
6 Amos Gouaux, University of Texas at Dallas
7 <amos+ruby@utdallas.edu>
8 &
9 Akinori MUSHA
10 <knu@iDaemons.org>
11
12 Contact:
13   - Akinori MUSHA <knu@iDaemons.org> (current maintainer)
14
15 ** Syslog(Module)
16
17 Included Modules: Syslog::Constants
18
19 require 'syslog'
20
21 A Simple wrapper for the UNIX syslog system calls that might be handy
22 if you're writing a server in Ruby.  For the details of the syslog(8)
23 architecture and constants, see the syslog(3) manual page of your
24 platform.
25
26 Module Methods:
27
28    open(ident = $0, logopt = Syslog::LOG_PID | Syslog::LOG_CONS,
29                 facility = Syslog::LOG_USER) [{ |syslog| ... }]
30
31         Opens syslog with the given options and returns the module
32         itself.  If a block is given, calls it with an argument of
33         itself.  If syslog is already opened, raises RuntimeError.
34
35         Example:
36           Syslog.open('ftpd', Syslog::LOG_PID | Syslog::LOG_NDELAY,
37                               Syslog::LOG_FTP)
38
39    open!(ident = $0, logopt = Syslog::LOG_PID | Syslog::LOG_CONS,
40                 facility = Syslog::LOG_USER)
41    reopen(ident = $0, logopt = Syslog::LOG_PID | Syslog::LOG_CONS,
42                 facility = Syslog::LOG_USER)
43
44         Same as open, but does a close first.
45
46    opened?
47
48         Returns true if syslog opened, otherwise false.
49
50    ident
51    options
52    facility
53
54         Returns the parameters given in the last open, respectively.
55         Every call of Syslog::open resets these values.
56
57    log(pri, message, ...)
58
59         Writes message to syslog.
60
61         Example:
62           Syslog.log(Syslog::LOG_CRIT, "the sky is falling in %d seconds!", 10)
63
64    crit(message, ...)
65    emerg(message, ...)
66    alert(message, ...)
67    err(message, ...)
68    warning(message, ...)
69    notice(message, ...)
70    info(message, ...)
71    debug(message, ...)
72
73         These are shortcut methods of Syslog::log().  The lineup may
74         vary depending on what priorities are defined on your system.
75
76         Example:
77           Syslog.crit("the sky is falling in %d seconds!", 5)
78  
79    mask
80    mask=(mask)
81
82         Returns or sets the log priority mask.  The value of the mask
83         is persistent and will not be reset by Syslog::open or
84         Syslog::close.
85
86         Example:
87           Syslog.mask = Syslog::LOG_UPTO(Syslog::LOG_ERR)
88
89    close 
90
91         Closes syslog.
92
93    inspect
94
95         Returns the "inspect" string of the Syslog module.
96
97    instance
98
99         Returns the module itself. (Just for backward compatibility)
100
101    LOG_MASK(pri)
102
103         Creates a mask for one priority.
104
105    LOG_UPTO(pri)
106
107         Creates a mask for all priorities up to pri.
108
109 ** Syslog::Constants(Module)
110
111 require 'syslog'
112 include Syslog::Constants
113
114 This module includes the LOG_* constants available on the system.
115
116 Module Methods:
117
118    LOG_MASK(pri)
119
120         Creates a mask for one priority.
121
122    LOG_UPTO(pri)
123
124         Creates a mask for all priorities up to pri.