4.4BSD/usr/share/man/cat3/closelog.0

Compare this file to the similar file:
Show the results in this format:

SYSLOG(3)                   BSD Programmer's Manual                  SYSLOG(3)

NNAAMMEE
     ssyysslloogg, vvssyysslloogg, ooppeennlloogg, cclloosseelloogg, sseettllooggmmaasskk - control system log

SSYYNNOOPPSSIISS
     ##iinncclluuddee <<ssyysslloogg..hh>>
     ##iinncclluuddee <<vvaarraarrggss..hh>>

     _v_o_i_d
     ssyysslloogg(_i_n_t _p_r_i_o_r_i_t_y, _c_o_n_s_t _c_h_a_r _*_m_e_s_s_a_g_e, _._._.);

     _v_o_i_d
     vvssyysslloogg(_i_n_t _p_r_i_o_r_i_t_y, _c_o_n_s_t _c_h_a_r _*_m_e_s_s_a_g_e, _v_a___l_i_s_t _a_r_g_s);

     _v_o_i_d
     ooppeennlloogg(_c_o_n_s_t _c_h_a_r _*_i_d_e_n_t, _i_n_t _l_o_g_o_p_t, _i_n_t _f_a_c_i_l_i_t_y);

     _v_o_i_d
     cclloosseelloogg(_v_o_i_d);

     _i_n_t
     sseettllooggmmaasskk(_i_n_t _m_a_s_k_p_r_i);

DDEESSCCRRIIPPTTIIOONN
     The ssyysslloogg() function writes _m_e_s_s_a_g_e to the system message logger.  The
     message is then written to the system console, log files, logged-in
     users, or forwarded to other machines as appropriate. (See syslogd(8).)

     The message is identical to a printf(3) format string, except that `%m'
     is replaced by the current error message. (As denoted by the global vari-
     able _e_r_r_n_o; see strerror(3).)  A trailing newline is added if none is
     present.

     The vvssyysslloogg() function is an alternate form in which the arguments have
     already been captured using the variable-length argument facilities of
     varargs(3).

     The message is tagged with _p_r_i_o_r_i_t_y. Priorities are encoded as a _f_a_c_i_l_i_t_y
     and a _l_e_v_e_l. The facility describes the part of the system generating the
     message.  The level is selected from the following _o_r_d_e_r_e_d (high to low)
     list:

     LOG_EMERG     A panic condition.  This is normally broadcast to all
                   users.

     LOG_ALERT     A condition that should be corrected immediately, such as a
                   corrupted system database.

     LOG_CRIT      Critical conditions, e.g., hard device errors.

     LOG_ERR       Errors.

     LOG_WARNING   Warning messages.

     LOG_NOTICE    Conditions that are not error conditions, but should possi-
                   bly be handled specially.

     LOG_INFO      Informational messages.

     LOG_DEBUG     Messages that contain information normally of use only when
                   debugging a program.

     The ooppeennlloogg() function provides for more specialized processing of the
     messages sent by ssyysslloogg() and vvssyysslloogg().  The parameter _i_d_e_n_t is a string
     that will be prepended to every message.  The _l_o_g_o_p_t argument is a bit
     field specifying logging options, which is formed by OR'ing one or more
     of the following values:

     LOG_CONS      If ssyysslloogg() cannot pass the message to syslogd it will at-
                   tempt to write the message to the console
                   (``_/_d_e_v_/_c_o_n_s_o_l_e_.'')

     LOG_NDELAY    Open the connection to syslogd immediately.  Normally the
                   open is delayed until the first message is logged.  Useful
                   for programs that need to manage the order in which file
                   descriptors are allocated.

     LOG_PERROR    Write the message to standard error output as well to the
                   system log.

     LOG_PID       Log the process id with each message: useful for identify-
                   ing instantiations of daemons.

     The _f_a_c_i_l_i_t_y parameter encodes a default facility to be assigned to all
     messages that do not have an explicit facility encoded:

     LOG_AUTH      The authorization system: login(1),  su(1),  getty(8),
                   etc.

     LOG_AUTHPRIV  The same as LOG_AUTH, but logged to a file readable only by
                   selected individuals.

     LOG_CRON      The clock daemon.

     LOG_DAEMON    System daemons, such as routed(8),  that are not provided
                   for explicitly by other facilities.

     LOG_KERN      Messages generated by the kernel.  These cannot be generat-
                   ed by any user processes.

     LOG_LPR       The line printer spooling system: lpr(1),  lpc(8),  lpd(8),
                    etc.

     LOG_MAIL      The mail system.

     LOG_NEWS      The network news system.

     LOG_SYSLOG    Messages generated internally by syslogd(8).

     LOG_USER      Messages generated by random user processes.  This is the
                   default facility identifier if none is specified.

     LOG_UUCP      The uucp system.

     LOG_LOCAL0    Reserved for local use.  Similarly for LOG_LOCAL1 through
                   LOG_LOCAL7.

     The cclloosseelloogg() function can be used to close the log file.

     The sseettllooggmmaasskk() function sets the log priority mask to _m_a_s_k_p_r_i and re-
     turns the previous mask.  Calls to ssyysslloogg() with a priority not set in
     _m_a_s_k_p_r_i are rejected.  The mask for an individual priority _p_r_i is calcu-
     lated by the macro LLOOGG__MMAASSKK(_p_r_i); the mask for all priorities up to and
     including _t_o_p_p_r_i is given by the macro LLOOGG__UUPPTTOO(_t_o_p_p_r_i);. The default al-
     lows all priorities to be logged.

RREETTUURRNN VVAALLUUEESS
     The routines cclloosseelloogg(), ooppeennlloogg(), ssyysslloogg() and vvssyysslloogg() return no val-
     ue.


     The routine sseettllooggmmaasskk() always returns the previous log mask level.

EEXXAAMMPPLLEESS
           syslog(LOG_ALERT, "who: internal error 23");

           openlog("ftpd", LOG_PID, LOG_DAEMON);
           setlogmask(LOG_UPTO(LOG_ERR));
           syslog(LOG_INFO, "Connection from host %d", CallingHost);

           syslog(LOG_INFO|LOG_LOCAL2, "foobar error: %m");

SSEEEE AALLSSOO
     logger(1),  syslogd(8)

HHIISSTTOORRYY
     These functions appeared in 4.2BSD.

4.2 Berkeley Distribution        June 4, 1993                                3