symbian-qemu-0.9.1-12/python-2.6.1/Doc/library/syslog.rst
changeset 1 2fb8b9db1c86
equal deleted inserted replaced
0:ffa851df0825 1:2fb8b9db1c86
       
     1 
       
     2 :mod:`syslog` --- Unix syslog library routines
       
     3 ==============================================
       
     4 
       
     5 .. module:: syslog
       
     6    :platform: Unix
       
     7    :synopsis: An interface to the Unix syslog library routines.
       
     8 
       
     9 
       
    10 This module provides an interface to the Unix ``syslog`` library routines.
       
    11 Refer to the Unix manual pages for a detailed description of the ``syslog``
       
    12 facility.
       
    13 
       
    14 The module defines the following functions:
       
    15 
       
    16 
       
    17 .. function:: syslog([priority,] message)
       
    18 
       
    19    Send the string *message* to the system logger.  A trailing newline is added if
       
    20    necessary.  Each message is tagged with a priority composed of a *facility* and
       
    21    a *level*.  The optional *priority* argument, which defaults to
       
    22    :const:`LOG_INFO`, determines the message priority.  If the facility is not
       
    23    encoded in *priority* using logical-or (``LOG_INFO | LOG_USER``), the value
       
    24    given in the :func:`openlog` call is used.
       
    25 
       
    26 
       
    27 .. function:: openlog(ident[, logopt[, facility]])
       
    28 
       
    29    Logging options other than the defaults can be set by explicitly opening the log
       
    30    file with :func:`openlog` prior to calling :func:`syslog`.  The defaults are
       
    31    (usually) *ident* = ``'syslog'``, *logopt* = ``0``, *facility* =
       
    32    :const:`LOG_USER`.  The *ident* argument is a string which is prepended to every
       
    33    message.  The optional *logopt* argument is a bit field - see below for possible
       
    34    values to combine.  The optional *facility* argument sets the default facility
       
    35    for messages which do not have a facility explicitly encoded.
       
    36 
       
    37 
       
    38 .. function:: closelog()
       
    39 
       
    40    Close the log file.
       
    41 
       
    42 
       
    43 .. function:: setlogmask(maskpri)
       
    44 
       
    45    Set the priority mask to *maskpri* and return the previous mask value.  Calls to
       
    46    :func:`syslog` with a priority level not set in *maskpri* are ignored.  The
       
    47    default is to log all priorities.  The function ``LOG_MASK(pri)`` calculates the
       
    48    mask for the individual priority *pri*.  The function ``LOG_UPTO(pri)``
       
    49    calculates the mask for all priorities up to and including *pri*.
       
    50 
       
    51 The module defines the following constants:
       
    52 
       
    53 Priority levels (high to low):
       
    54    :const:`LOG_EMERG`, :const:`LOG_ALERT`, :const:`LOG_CRIT`, :const:`LOG_ERR`,
       
    55    :const:`LOG_WARNING`, :const:`LOG_NOTICE`, :const:`LOG_INFO`,
       
    56    :const:`LOG_DEBUG`.
       
    57 
       
    58 Facilities:
       
    59    :const:`LOG_KERN`, :const:`LOG_USER`, :const:`LOG_MAIL`, :const:`LOG_DAEMON`,
       
    60    :const:`LOG_AUTH`, :const:`LOG_LPR`, :const:`LOG_NEWS`, :const:`LOG_UUCP`,
       
    61    :const:`LOG_CRON` and :const:`LOG_LOCAL0` to :const:`LOG_LOCAL7`.
       
    62 
       
    63 Log options:
       
    64    :const:`LOG_PID`, :const:`LOG_CONS`, :const:`LOG_NDELAY`, :const:`LOG_NOWAIT`
       
    65    and :const:`LOG_PERROR` if defined in ``<syslog.h>``.
       
    66