Movatterモバイル変換


[0]ホーム

URL:


Up one LevelPython Library ReferenceContentsModule IndexIndex

16.15syslog --Unix syslog library routines

Availability:Unix.

This module provides an interface to theUnixsyslog libraryroutines. Refer to theUnix manual pages for a detailed descriptionof thesyslog facility.

The module defines the following functions:

syslog([priority,] message)
Send the stringmessage to the system logger. A trailingnewline is added if necessary. Each message is tagged with a prioritycomposed of afacility and alevel. The optionalpriority argument, which defaults toLOG_INFO,determines the message priority. If the facility is not encoded inpriority using logical-or (LOG_INFO | LOG_USER), thevalue given in theopenlog() call is used.

openlog(ident[, logopt[, facility]])
Logging options other than the defaults can be set by explicitlyopening the log file withopenlog() prior to callingsyslog(). The defaults are (usually)ident ='syslog',logopt =0,facility =LOG_USER. Theident argument is a string which isprepended to every message. The optionallogopt argument is abit field - see below for possible values to combine. The optionalfacility argument sets the default facility for messages whichdo not have a facility explicitly encoded.

closelog()
Close the log file.

setlogmask(maskpri)
Set the priority mask tomaskpri and return theprevious mask value. Calls tosyslog() with a prioritylevel not set inmaskpri are ignored. The default is to log allpriorities. The functionLOG_MASK(pri) calculates themask for the individual prioritypri. The functionLOG_UPTO(pri) calculates the mask for all priorities upto and includingpri.

The module defines the following constants:

Priority levels (high to low):

LOG_EMERG,LOG_ALERT,LOG_CRIT,LOG_ERR,LOG_WARNING,LOG_NOTICE,LOG_INFO,LOG_DEBUG.

Facilities:

LOG_KERN,LOG_USER,LOG_MAIL,LOG_DAEMON,LOG_AUTH,LOG_LPR,LOG_NEWS,LOG_UUCP,LOG_CRON andLOG_LOCAL0 toLOG_LOCAL7.

Log options:

LOG_PID,LOG_CONS,LOG_NDELAY,LOG_NOWAIT andLOG_PERROR if defined in<syslog.h>.


Up one LevelPython Library ReferenceContentsModule IndexIndex

Release 2.5.2, documentation updated on 21st February, 2008.
SeeAbout this document... for information on suggesting changes.
[8]ページ先頭

©2009-2025 Movatter.jp