| 
									
										
										
										
											1998-08-10 19:42:37 +00:00
										 |  |  | \section{\module{syslog} --- | 
					
						
							| 
									
										
										
										
											1999-03-02 16:37:17 +00:00
										 |  |  |          \UNIX{} syslog library routines} | 
					
						
							| 
									
										
										
										
											1998-07-23 17:59:49 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											1999-03-02 16:37:17 +00:00
										 |  |  | \declaremodule{builtin}{syslog} | 
					
						
							| 
									
										
										
										
											1999-03-02 17:03:42 +00:00
										 |  |  |   \platform{Unix} | 
					
						
							| 
									
										
										
										
											1998-07-23 17:59:49 +00:00
										 |  |  | \modulesynopsis{An interface to the \UNIX{} syslog library routines.} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											1995-10-09 20:49:57 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											1998-01-13 22:41:33 +00:00
										 |  |  | This module provides an interface to the \UNIX{} \code{syslog} library | 
					
						
							| 
									
										
										
										
											1995-10-09 20:49:57 +00:00
										 |  |  | routines.  Refer to the \UNIX{} manual pages for a detailed description | 
					
						
							|  |  |  | of the \code{syslog} facility. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | The module defines the following functions: | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											1997-11-30 05:27:26 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											1998-03-17 06:33:25 +00:00
										 |  |  | \begin{funcdesc}{syslog}{\optional{priority,} message} | 
					
						
							| 
									
										
										
										
											1998-04-29 14:38:34 +00:00
										 |  |  | Send the string \var{message} to the system logger.  A trailing | 
					
						
							|  |  |  | newline is added if necessary.  Each message is tagged with a priority | 
					
						
							|  |  |  | composed of a \var{facility} and a \var{level}.  The optional | 
					
						
							|  |  |  | \var{priority} argument, which defaults to \constant{LOG_INFO}, | 
					
						
							|  |  |  | determines the message priority.  If the facility is not encoded in | 
					
						
							|  |  |  | \var{priority} using logical-or (\code{LOG_INFO | LOG_USER}), the | 
					
						
							|  |  |  | value given in the \function{openlog()} call is used. | 
					
						
							| 
									
										
										
										
											1995-10-09 20:49:57 +00:00
										 |  |  | \end{funcdesc} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											1998-01-13 22:41:33 +00:00
										 |  |  | \begin{funcdesc}{openlog}{ident\optional{, logopt\optional{, facility}}} | 
					
						
							| 
									
										
										
										
											1998-04-29 14:38:34 +00:00
										 |  |  | Logging options other than the defaults can be set by explicitly | 
					
						
							|  |  |  | opening the log file with \function{openlog()} prior to calling | 
					
						
							|  |  |  | \function{syslog()}.  The defaults are (usually) \var{ident} = | 
					
						
							|  |  |  | \code{'syslog'}, \var{logopt} = \code{0}, \var{facility} = | 
					
						
							|  |  |  | \constant{LOG_USER}.  The \var{ident} argument is a string which is | 
					
						
							|  |  |  | prepended to every message.  The optional \var{logopt} argument is a | 
					
						
							|  |  |  | bit field - see below for possible values to combine.  The optional | 
					
						
							|  |  |  | \var{facility} argument sets the default facility for messages which | 
					
						
							|  |  |  | do not have a facility explicitly encoded. | 
					
						
							| 
									
										
										
										
											1995-10-09 20:49:57 +00:00
										 |  |  | \end{funcdesc} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | \begin{funcdesc}{closelog}{} | 
					
						
							|  |  |  | Close the log file. | 
					
						
							|  |  |  | \end{funcdesc} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | \begin{funcdesc}{setlogmask}{maskpri} | 
					
						
							| 
									
										
										
										
											1999-02-19 17:54:10 +00:00
										 |  |  | Set the priority mask to \var{maskpri} and return the | 
					
						
							| 
									
										
										
										
											1998-04-29 14:38:34 +00:00
										 |  |  | previous mask value.  Calls to \function{syslog()} with a priority | 
					
						
							|  |  |  | level not set in \var{maskpri} are ignored.  The default is to log all | 
					
						
							|  |  |  | priorities.  The function \code{LOG_MASK(\var{pri})} calculates the | 
					
						
							|  |  |  | mask for the individual priority \var{pri}.  The function | 
					
						
							|  |  |  | \code{LOG_UPTO(\var{pri})} calculates the mask for all priorities up | 
					
						
							|  |  |  | to and including \var{pri}. | 
					
						
							| 
									
										
										
										
											1995-10-09 20:49:57 +00:00
										 |  |  | \end{funcdesc} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											1999-02-19 17:54:10 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											1995-10-09 20:49:57 +00:00
										 |  |  | The module defines the following constants: | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | \begin{description} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | \item[Priority levels (high to low):] | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											1998-04-29 14:38:34 +00:00
										 |  |  | \constant{LOG_EMERG}, \constant{LOG_ALERT}, \constant{LOG_CRIT}, | 
					
						
							|  |  |  | \constant{LOG_ERR}, \constant{LOG_WARNING}, \constant{LOG_NOTICE}, | 
					
						
							|  |  |  | \constant{LOG_INFO}, \constant{LOG_DEBUG}. | 
					
						
							| 
									
										
										
										
											1995-10-09 20:49:57 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | \item[Facilities:] | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											1998-04-29 14:38:34 +00:00
										 |  |  | \constant{LOG_KERN}, \constant{LOG_USER}, \constant{LOG_MAIL}, | 
					
						
							|  |  |  | \constant{LOG_DAEMON}, \constant{LOG_AUTH}, \constant{LOG_LPR}, | 
					
						
							|  |  |  | \constant{LOG_NEWS}, \constant{LOG_UUCP}, \constant{LOG_CRON} and | 
					
						
							|  |  |  | \constant{LOG_LOCAL0} to \constant{LOG_LOCAL7}. | 
					
						
							| 
									
										
										
										
											1995-10-09 20:49:57 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | \item[Log options:] | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											1998-04-29 14:38:34 +00:00
										 |  |  | \constant{LOG_PID}, \constant{LOG_CONS}, \constant{LOG_NDELAY}, | 
					
						
							|  |  |  | \constant{LOG_NOWAIT} and \constant{LOG_PERROR} if defined in | 
					
						
							|  |  |  | \code{<syslog.h>}. | 
					
						
							| 
									
										
										
										
											1995-10-09 20:49:57 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | \end{description} |