Annotation of 43BSDReno/contrib/isode-beta/h/logger.h, revision 1.1.1.1

1.1       root        1: /* logger.h - logging routines */
                      2: 
                      3: /* 
                      4:  * $Header: /f/osi/h/RCS/logger.h,v 7.1 90/07/01 21:03:49 mrose Exp $
                      5:  *
                      6:  *
                      7:  * $Log:       logger.h,v $
                      8:  * Revision 7.1  90/07/01  21:03:49  mrose
                      9:  * pepsy
                     10:  * 
                     11:  * Revision 7.0  89/11/23  21:55:48  mrose
                     12:  * Release 6.0
                     13:  * 
                     14:  */
                     15: 
                     16: /*
                     17:  *                               NOTICE
                     18:  *
                     19:  *    Acquisition, use, and distribution of this module and related
                     20:  *    materials are subject to the restrictions of a license agreement.
                     21:  *    Consult the Preface in the User's Manual for the full terms of
                     22:  *    this agreement.
                     23:  *
                     24:  */
                     25: 
                     26: 
                     27: #ifndef        _LOGGER_
                     28: #define        _LOGGER_
                     29: 
                     30: /*  */
                     31: 
                     32: typedef struct  ll_struct {
                     33:     char   *ll_file;           /* path name to logging file */
                     34: 
                     35:     char   *ll_hdr;            /* text to put in opening line */
                     36:     char   *ll_dhdr;           /* dynamic header - changes */
                     37: 
                     38:     int            ll_events;          /* interesting events */
                     39: #define        LLOG_NONE       0
                     40: #define        LLOG_FATAL      0x01    /*   fatal errors */
                     41: #define        LLOG_EXCEPTIONS 0x02    /*   exceptional events */
                     42: #define        LLOG_NOTICE     0x04    /*   informational notices */
                     43: #define        LLOG_PDUS       0x08    /*   PDU printing */
                     44: #define        LLOG_TRACE      0x10    /*   program tracing */
                     45: #define        LLOG_DEBUG      0x20    /*   full debugging */
                     46: #define        LLOG_ALL        0xff
                     47: #define        LLOG_MASK \
                     48:     "\020\01FATAL\02EXCEPTIONS\03NOTICE\04PDUS\05TRACE\06DEBUG"
                     49: 
                     50:     int            ll_syslog;          /* interesting events to send to syslog */
                     51:                                /*   takes same values as ll_events */
                     52: 
                     53:     int     ll_msize;          /* max size for log, in Kbytes */
                     54: 
                     55:     int     ll_stat;           /* assorted switches */
                     56: #define        LLOGNIL         0x00
                     57: #define        LLOGCLS         0x01    /*   keep log closed, except when writing */
                     58: #define        LLOGCRT         0x02    /*   create log if necessary */
                     59: #define        LLOGZER         0x04    /*   truncate log when limits reached */
                     60: #define        LLOGERR         0x08    /*   log closed due to (soft) error */
                     61: #define        LLOGTTY         0x10    /*   also log to stderr */
                     62: #define        LLOGHDR         0x20    /*   static header allocated */
                     63: #define        LLOGDHR         0x40    /*   dynamic header allocated */
                     64: 
                     65:     int     ll_fd;             /* file descriptor */
                     66: } LLog;
                     67: 
                     68: /*  */
                     69: 
                     70: #define        SLOG(lp,event,what,args) \
                     71: if (lp -> ll_events & (event)) { \
                     72:     (void) ll_log (lp, event, what, "%s", ll_preset args); \
                     73: } \
                     74: else
                     75: 
                     76: #ifndef        LLOG
                     77: #define        LLOG(lp,event,args)     SLOG (lp, event, NULLCP, args)
                     78: #endif
                     79: 
                     80: #ifdef DEBUG
                     81: #define        DLOG(lp,event,args)     SLOG (lp, event, NULLCP, args)
                     82: #else
                     83: #define        DLOG(lp,event,args)
                     84: #endif
                     85: 
                     86: 
                     87: #ifdef DEBUG
                     88: 
                     89: #ifdef PEPSY_VERSION
                     90: 
                     91: #ifdef __STDC__
                     92: 
                     93: #define        PLOGP(lp,args,pe,text,rw) \
                     94:     if ((lp) -> ll_events & LLOG_PDUS) { \
                     95:        pvpdu (lp, print_##args##_P, pe, text, rw); \
                     96: } \
                     97: 
                     98: #define        PLOG(lp,fnx,pe,text,rw) \
                     99:     if ((lp) -> ll_events & LLOG_PDUS) { \
                    100:        pvpdu (lp, fnx##_P, pe, text, rw); \
                    101: } \
                    102: else
                    103: 
                    104: #else
                    105: 
                    106: #define        PLOGP(lp,args,pe,text,rw) \
                    107:     if ((lp) -> ll_events & LLOG_PDUS) { \
                    108:        pvpdu (lp, print_/* */args/* */_P, pe, text, rw); \
                    109: } \
                    110: else
                    111: 
                    112: #define        PLOG(lp,fnx,pe,text,rw) \
                    113:     if ((lp) -> ll_events & LLOG_PDUS) { \
                    114:        pvpdu (lp, fnx/* */_P, pe, text, rw); \
                    115: } \
                    116: else
                    117: 
                    118: #endif
                    119: 
                    120: #else  /* !PEPSY_VERSION */
                    121: 
                    122: #define        PLOG(lp,fnx,pe,text,rw) \
                    123:     if ((lp) -> ll_events & LLOG_PDUS) { \
                    124:        vpdu (lp, fnx, pe, text, rw); \
                    125: } \
                    126: else
                    127: 
                    128: #endif /* !PEPSY_VERSION */
                    129: 
                    130: #else  /* !DEBUG */
                    131: #define        PLOG(lp,fnx,pe,text,rw)
                    132: #define        PLOGP(lp,args,pe,text,rw)
                    133: #endif
                    134: 
                    135: 
                    136: int    ll_open ();
                    137: int    ll_log (), _ll_log ();
                    138: int    ll_close ();
                    139: 
                    140: void   ll_hdinit ();
                    141: void   ll_dbinit ();
                    142: 
                    143: int    ll_printf ();
                    144: int    ll_sync ();
                    145: 
                    146: char   *ll_preset ();
                    147: 
                    148: int    ll_check ();
                    149: #endif

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.