home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / gnu / fax-3.2.1 / lib / libutil / logmsg.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-07-31  |  3.0 KB  |  161 lines

  1. /*
  2.   This file is part of the NetFax system.
  3.  
  4.   (c) Copyright 1989 by David M. Siegel and Sundar Narasimhan.
  5.       All rights reserved.
  6.  
  7.     This program is free software; you can redistribute it and/or modify
  8.     it under the terms of the GNU General Public License as published by
  9.     the Free Software Foundation.
  10.  
  11.     This program is distributed in the hope that it will be useful, 
  12.     but WITHOUT ANY WARRANTY; without even the implied warranty of 
  13.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14.     GNU General Public License for more details.
  15.  
  16.     You should have received a copy of the GNU General Public License
  17.     along with this program; if not, write to the Free Software
  18.     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  19. */
  20.  
  21. #ifndef INClogmsgh
  22. #define INClogmsgh 1
  23.  
  24. #include <syslog.h>
  25.  
  26. #define MAX_LOG_LEVEL    LOG_DEBUG
  27.  
  28. typedef struct _log {
  29.     int mask[MAX_LOG_LEVEL+1];
  30.     int type;
  31.     int style;
  32.     FILE *fp;
  33. } LOG;
  34.  
  35. /* log styles */
  36. #define L_STYLE_TIME    001            /* include time/date     */
  37. #define L_STYLE_LINE    002            /* include file/line    */
  38. #define L_STYLE_ALL    (L_STYLE_TIME|L_STYLE_LINE)
  39.  
  40. /* log masks */
  41. #define L_MASK_ALL    -1            /* all catagories    */
  42.  
  43. /* log types */
  44. #define L_TYPE_FILE    0    /* log to a file    */
  45. #define L_TYPE_FP    1    /* log to an fp        */
  46. #define L_TYPE_SYSLOG    2    /* log to syslog    */
  47.  
  48. /* log levels */
  49. #define L_EMERG   LOG_EMERG,__FILE__,__LINE__    /* system is unusabled    */
  50. #define L_ALERT      LOG_ALERT,__FILE__,__LINE__    /* action must be taken    */
  51. #define L_CRIT      LOG_CRIT,__FILE__,__LINE__    /* critical condition    */
  52. #define L_ERR      LOG_ERR,__FILE__,__LINE__    /* error condition    */
  53. #define L_WARNING LOG_WARNING,__FILE__,__LINE__    /* warning condition    */
  54. #define L_NOTICE  LOG_NOTICE,__FILE__,__LINE__    /* normal but signif    */
  55. #define L_INFO    LOG_INFO,__FILE__,__LINE__    /* informational    */
  56. #define L_DEBUG   LOG_DEBUG,__FILE__,__LINE__    /* debug-level message    */
  57.  
  58. /* used to parse a symbolic mask list */
  59. typedef struct {
  60.     char *name;
  61.     int  bit;
  62. } LOGMASK_ALIST;
  63.  
  64. /*
  65.   Prototypes:
  66. */
  67.  
  68. /*VARARGS*/
  69. int logmsg();
  70.  
  71. /*VARARGS*/
  72. int notice();
  73.  
  74. int log_set_limit(
  75. #ifdef _PROTO
  76.     int rate
  77. #endif
  78. );
  79.  
  80. int log_reset_limits(
  81. #ifdef _PROTO
  82.     void
  83. #endif             
  84. );
  85.  
  86. int log_set_mask(
  87. #ifdef _PROTO
  88.     LOG *log, 
  89.     int level,
  90.     int mask
  91. #endif
  92. );
  93.  
  94. int log_set_level(
  95. #ifdef _PROTO
  96.     LOG *log, 
  97.     int level
  98. #endif
  99. );
  100.  
  101. LOG *log_open_syslog(
  102. #ifdef _PROTO
  103.     char *ident, 
  104.     int logopt,
  105.     int facility, 
  106.     int level, 
  107.     int mask,
  108.     int style
  109. #endif
  110. );
  111.  
  112. LOG *log_open_fp(
  113. #ifdef _PROTO
  114.     FILE *fp,
  115.     int level,
  116.     int mask,
  117.     int style
  118. #endif
  119. );
  120.  
  121. LOG *log_open_file(
  122. #ifdef _PROTO
  123.     char *filename,
  124.     int level,
  125.     int mask,
  126.     int style
  127. #endif
  128. );
  129.  
  130. int log_close(
  131. #ifdef _PROTO
  132.     LOG *log
  133. #endif
  134. );
  135.  
  136. int log_parse_mask(
  137. #ifdef _PROTO
  138.     char *mask_str, 
  139.     LOGMASK_ALIST *alist,
  140.     int size,
  141.     int *maskp
  142. #endif
  143. );
  144.  
  145. int log_open_network(
  146. #ifdef _PROTO
  147.     int dispatch_priority,
  148.     char *service
  149. #endif
  150. );
  151.  
  152. int log_connect(
  153. #ifdef _PROTO
  154.     char *host,
  155.     char *service,
  156.     int level
  157. #endif
  158. );
  159.  
  160. #endif
  161.