home *** CD-ROM | disk | FTP | other *** search
/ Super Net 1 / SUPERNET_1.iso / PC / OTROS / UNIX / ARCHIE / CLIENTS / NEXTARCH.TAR / NeXTArchie / include / plog.h < prev    next >
Encoding:
C/C++ Source or Header  |  1991-08-11  |  5.9 KB  |  140 lines

  1. /*
  2.  * Copyright (c) 1989, 1990, 1991 by the University of Washington
  3.  *
  4.  * For copying and distribution information, please see the file
  5.  * <uw-copyright.h>.
  6.  */
  7.  
  8. #include <uw-copyright.h>
  9.  
  10. /* If defined in psite.h, that definition overrides the one below */
  11. #ifndef PFS_LOGFILE
  12. #define PFS_LOGFILE  "pfs.log"  
  13. #endif  PFS_LOGFILE
  14.  
  15. /*
  16.  * This following definitions define the types of log messages logged by 
  17.  * plog.  The action to be taken for each event can be selectively
  18.  * defined by setting the corresponding entry in INITIAL_LOG_VECTOR.
  19.  */
  20.  
  21. #define MXPLOGENTRY    1000    /* Maximum length of single entry   */
  22.  
  23. #define    NLOGTYPE    20    /* Maximum number of log msg types  */
  24.  
  25. #define L_FIELDS      0    /* Fields to include in messages    */
  26. #define L_STATUS      1    /* Startup, termination, etc        */
  27. #define L_FAILURE      2    /* Failure condition                */
  28. #define L_STATS          3    /* Statistics on server usage       */
  29. #define L_NET_ERR      4    /* Unexpected error in network code */
  30. #define L_NET_RDPERR      5     /* Reliable datagram protocol error */
  31. #define L_NET_INFO      6    /* Info on network activity        */
  32. #define L_QUEUE_INFO      7     /* Info on queue managment          */
  33. #define L_DIR_PERR      8    /* PFS Directory protocol errors    */
  34. #define L_DIR_PWARN       9    /* PFS Directory protocol warning   */
  35. #define L_DIR_PINFO     10    /* PFS Directory protocol info        */
  36. #define L_DIR_ERR     11    /* PFS Request error            */
  37. #define L_DIR_WARN     12    /* PFS Request warning            */
  38. #define L_DIR_REQUEST     13    /* PFS information request        */
  39. #define L_DIR_UPDATE     14     /* PFS information update           */
  40. #define L_AUTH_ERR       15     /* Unauthorized operation attempted */
  41. #define L_DATA_FRM_ERR     16     /* PFS directory format error       */
  42. #define L_DB_ERROR     17     /* Error in database operation      */
  43. #define L_DB_INFO     18     /* Error in database operation      */
  44. #define L_ERR_UNK  NLOGTYPE    /* Unknown error type            */
  45.  
  46. /* Fields to include in log messages (L_FIELDS_HNAME not yet implemented) */
  47. #define L_FIELDS_USER_R 0x01    /* Include user ID in request log message */
  48. #define L_FIELDS_USER_U 0x02    /* Include user ID in update log messages */
  49. #define L_FIELDS_USER_I 0x04    /* Include user ID in informational msgs  */
  50. #define L_FIELDS_HADDR  0x08    /* Include host address in log messages   */
  51. #define L_FIELDS_HNAME  0x10    /* Include host name in log messages      */
  52.  
  53. #define L_FIELDS_USER    (L_FIELDS_USER_R|L_FIELDS_USER_U|L_FIELDS_USER_I)
  54.  
  55. #define PLOG_TOFILE_ENABLED  0x80000000
  56. #define PLOG_TOFILE_DISABLED 0x00000000
  57.  
  58. /* 
  59.  * If log messages are to be written to the prospero log file,
  60.  * PLOG_TOFILE must be set to PLOG_TOFILE_ENABLED.  To disable logging
  61.  * to the log file, it's value should be PLOG_TOFILE_DISABLED.  Note that
  62.  * it is acceptable to log to both syslog and the log file.
  63.  */
  64. #ifndef PLOG_TOFILE
  65. #define PLOG_TOFILE PLOG_TOFILE_ENABLED
  66. #endif  PLOG_TOFILE
  67.  
  68. /*  
  69.  * P_LOGTO_SYSLOG should be defined if log messages are to be sent to syslog.
  70.  * If you are logging to syslog, you will probably be better off if you 
  71.  * assign one of the local facility names (e.g., LOG_LOCAL1) to Prospero and
  72.  * define LOG_PROSPERO (below) accordingly.  By default, Prospero does a lot
  73.  * of logging.  If you choose to use LOG_DAEMON (which is the default value
  74.  * of LOG_PROSPERO), you might want to turn off logging of certain events 
  75.  * to reduce clutter in your system wide log files.
  76.  *
  77.  * #define P_LOGTO_SYSLOG
  78.  */
  79.  
  80. #ifdef P_LOGTO_SYSLOG 
  81. #include <syslog.h>
  82. #define LOG_PROSPERO LOG_DAEMON
  83. #else 
  84. #define LOG_PROSPERO 0
  85. #endif 
  86.  
  87. #ifndef LOG_INFO
  88. #define LOG_CRIT    2
  89. #define LOG_ERR        3
  90. #define LOG_WARNING    4
  91. #define LOG_NOTICE    5
  92. #define LOG_INFO    6
  93. #endif  LOG_INFO
  94.  
  95.  
  96. /*
  97.  * INITIAL_LOG_VECTOR defines the actions to be taken for log messages
  98.  * of particular types.  If INITIAL_LOG_VECTOR is defined in psite.h,
  99.  * that definition will override the definition that appears here.
  100.  *
  101.  * Event 0 in the vector is a bit vector identifying the information
  102.  * to be included in each log message (see L_FIELDS above).  All other
  103.  * events in the vector specify the (OR'd together) syslog facility and
  104.  * priority to be used for the log message if P_LOGTO_SYSLOG is defined.
  105.  * The facility and priority are also OR'd with PLOG_TOFILE to indicate
  106.  * that the message should be written to the Prospero logfile
  107.  * (conditional on PLOG_TOFILE being enabled).  If the entry for an
  108.  * event is 0, then no logging will occur.
  109.  *
  110.  * NOTE: The syslog event and priority of 0 is being overloaded.  
  111.  *       You cannot specify the combination of the LOG_EMERG priority
  112.  *       and the LOG_KERN facility.  
  113.  */
  114. #ifndef INITIAL_LOG_VECTOR
  115. #define INITIAL_LOG_VECTOR { \
  116.     L_FIELDS_USER|L_FIELDS_HADDR,      /* L_FIELDS       */       \
  117.     LOG_PROSPERO|LOG_NOTICE|PLOG_TOFILE,  /* L_STATUS       */       \
  118.     LOG_PROSPERO|LOG_CRIT|PLOG_TOFILE,      /* L_FAILURE      */       \
  119.     PLOG_TOFILE,              /* L_STATS        */       \
  120.     LOG_PROSPERO|LOG_ERR|PLOG_TOFILE,      /* L_NET_ERR      */       \
  121.     LOG_PROSPERO|LOG_ERR|PLOG_TOFILE,      /* L_NET_RDPERR   */       \
  122.     0,                      /* L_NET_INFO     */       \
  123.     LOG_PROSPERO|LOG_INFO|PLOG_TOFILE,      /* L_QUEUE_INFO   */       \
  124.     LOG_PROSPERO|LOG_ERR|PLOG_TOFILE,      /* L_DIR_PERR     */       \
  125.     LOG_PROSPERO|LOG_WARNING|PLOG_TOFILE, /* L_DIR_PWARN    */       \
  126.     LOG_PROSPERO|LOG_INFO|PLOG_TOFILE,      /* L_DIR_PINFO    */       \
  127.     LOG_PROSPERO|LOG_ERR|PLOG_TOFILE,      /* L_DIR_ERR      */       \
  128.     LOG_PROSPERO|LOG_WARNING|PLOG_TOFILE, /* L_DIR_WARN     */       \
  129.     LOG_PROSPERO|LOG_INFO|PLOG_TOFILE,      /* L_DIR_REQUEST  */       \
  130.     LOG_PROSPERO|LOG_INFO|PLOG_TOFILE,      /* L_DIR_UPDATE   */       \
  131.     LOG_PROSPERO|LOG_WARNING|PLOG_TOFILE, /* L_AUTH_ERR     */       \
  132.     LOG_PROSPERO|LOG_ERR|PLOG_TOFILE,      /* L_DATA_FRM_ERR */       \
  133.     LOG_PROSPERO|LOG_ERR|PLOG_TOFILE,      /* L_DB_ERROR     */       \
  134.     LOG_PROSPERO|LOG_INFO|PLOG_TOFILE      /* L_DB_INFO      */       \
  135. }
  136.  
  137. #endif  INITIAL_LOG_VECTOR
  138.  
  139. char    *plog();
  140.