From: Gary Williams Date: Wed, 17 Jan 2001 17:08:44 +0000 (+0000) Subject: new logging X-Git-Tag: LDBM_PRE_GIANT_RWLOCK~1580 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=16e642232904dabd6951bec39aa04a41156d2a50;p=openldap new logging --- diff --git a/libraries/liblber/decode.c b/libraries/liblber/decode.c index c0e22c0de3..5459b8d675 100644 --- a/libraries/liblber/decode.c +++ b/libraries/liblber/decode.c @@ -109,7 +109,7 @@ ber_skip_tag( BerElement *ber, ber_len_t *len ) /* * Next, read the length. The first byte contains the length of - * the length. If bit 8 is set, the length is the long form, + * the length. If bit 8 is set, the length is the long form, * otherwise it's the short form. We don't allow a length that's * greater than what we can hold in a ber_len_t. */ @@ -477,7 +477,7 @@ ber_scanf ( BerElement *ber, LDAP_CONST char *fmt_reset; char *last; char *s, **ss, ***sss; - struct berval ***bv, **bvp, *bval; + struct berval ***bv, **bvp, *bval; ber_int_t *i; int j; ber_len_t *l; @@ -495,8 +495,8 @@ ber_scanf ( BerElement *ber, fmt_reset = fmt; #ifdef NEW_LOGGING - LDAP_LOG(( "LIBLBER", LDAP_LEVEL_ENTRY, "ber_scanf fmt (%s) ber:\n", fmt )); - BER_DUMP(( "LIBLBER", LDAP_LEVEL_DETAIL2, ber, 1 )); + LDAP_LOG(( "liblber", LDAP_LEVEL_ENTRY, "ber_scanf fmt (%s) ber:\n", fmt )); + BER_DUMP(( "liblber", LDAP_LEVEL_DETAIL2, ber, 1 )); #else ber_log_printf( LDAP_DEBUG_TRACE, ber->ber_debug, "ber_scanf fmt (%s) ber:\n", fmt ); @@ -629,8 +629,13 @@ ber_scanf ( BerElement *ber, default: if( ber->ber_debug ) { +#ifdef NEW_LOGGING + LDAP_LOG(( "liblber", LDAP_LEVEL_ERR, + "ber_scanf: unknown fmt %c\n", *fmt )); +#else ber_log_printf( LDAP_DEBUG_ANY, ber->ber_debug, "ber_scanf: unknown fmt %c\n", *fmt ); +#endif } rc = LBER_DEFAULT; break; @@ -715,7 +720,7 @@ ber_scanf ( BerElement *ber, case 'v': /* sequence of strings */ sss = va_arg( ap, char *** ); if ( *sss ) { - for (j = 0; (*sss)[j]; j++) { + for (j = 0; (*sss)[j]; j++) { LBER_FREE( (*sss)[j] ); (*sss)[j] = NULL; } diff --git a/libraries/liblber/encode.c b/libraries/liblber/encode.c index dae8090ee8..59ef8ad677 100644 --- a/libraries/liblber/encode.c +++ b/libraries/liblber/encode.c @@ -1,4 +1,4 @@ -/* encode.c - ber output encoding routines */ +/* Encode.c - ber output encoding routines */ /* $OpenLDAP$ */ /* * Copyright 1998-2000 The OpenLDAP Foundation, All Rights Reserved. @@ -187,7 +187,7 @@ ber_put_int_or_enum( assert( BER_VALID( ber ) ); sign = (num < 0); - unum = num; /* Bit fiddling should be done with unsigned values */ + unum = num; /* Bit fiddling should be done with unsigned values */ /* * high bit is set - look for first non-all-one byte @@ -506,7 +506,7 @@ ber_put_seqorset( BerElement *ber ) /* * If this is the toplevel sequence or set, we need to actually - * write the stuff out. Otherwise, it's already been put in + * write the stuff out. Otherwise, it's already been put in * the appropriate buffer and will be written when the toplevel * one is written. In this case all we need to do is update the * length and tag. @@ -584,7 +584,7 @@ ber_put_seqorset( BerElement *ber ) /* The sos_ptr exceeds the end of the BerElement * this can happen, for example, when the sos_ptr * is near the end and no data was written for the - * 'V'. We must realloc the BerElement to ensure + * 'V'. We must realloc the BerElement to ensure * we don't overwrite the buffer when writing * the tag and length fields. */ @@ -797,8 +797,13 @@ ber_printf( BerElement *ber, LDAP_CONST char *fmt, ... ) default: if( ber->ber_debug ) { +#ifdef NEW_LOGGING + LDAP_LOG(( "liblber", LDAP_LEVEL_ERR, + "ber_printf: unknown fmt %c\n", *fmt )); +#else ber_log_printf( LDAP_DEBUG_ANY, ber->ber_debug, "ber_printf: unknown fmt %c\n", *fmt ); +#endif } rc = -1; break; diff --git a/libraries/liblber/io.c b/libraries/liblber/io.c index 1e78515c4c..b4cc7e5267 100644 --- a/libraries/liblber/io.c +++ b/libraries/liblber/io.c @@ -150,7 +150,7 @@ ber_realloc( BerElement *ber, ber_len_t len ) /* * If the stinking thing was moved, we need to go through and - * reset all the sos and ber pointers. Offsets would've been + * reset all the sos and ber pointers. Offsets would've been * a better idea... oh well. */ @@ -217,12 +217,20 @@ ber_flush( Sockbuf *sb, BerElement *ber, int freeit ) towrite = ber->ber_ptr - ber->ber_rwptr; if ( sb->sb_debug ) { +#ifdef NEW_LOGGING + LDAP_LOG(( "liblber", LDAP_LEVEL_DETAIL1, + "ber_flush: %ld bytes to sd %ld%s\n", + towrite, (long)sb->sb_fd, + ber->ber_rwptr != ber->ber_buf ? " (re-flush)" : "" )); + BER_DUMP(( "liblber", LDAP_LEVEL_DETAIL2, ber, 1 )); +#else ber_log_printf( LDAP_DEBUG_ANY, sb->sb_debug, "ber_flush: %ld bytes to sd %ld%s\n", towrite, (long) sb->sb_fd, ber->ber_rwptr != ber->ber_buf ? " (re-flush)" : "" ); ber_log_bprint( LDAP_DEBUG_PACKETS, sb->sb_debug, ber->ber_rwptr, towrite ); +#endif } nwritten = 0; @@ -431,8 +439,12 @@ ber_get_next( assert( SOCKBUF_VALID( sb ) ); assert( BER_VALID( ber ) ); +#ifdef NEW_LOGGING + LDAP_LOG(( "liblber", LDAP_LEVEL_ENTRY, "ber_get_next: enter\n" )); +#else ber_log_printf( LDAP_DEBUG_TRACE, ber->ber_debug, "ber_get_next\n" ); +#endif /* * Any ber element looks like this: tag length contents. @@ -567,10 +579,17 @@ fill_buffer: ber->ber_rwptr = NULL; *len = ber->ber_len; if ( ber->ber_debug ) { +#ifdef NEW_LOGGING + LDAP_LOG(( "liblber", LDAP_LEVEL_DETAIL1, + "ber_get_next: tag 0x%lx len %ld\n", + ber->ber_tag, ber->ber_len )); + BER_DUMP(( "liblber", LDAP_LEVEL_DETAIL2, ber, 1 )); +#else ber_log_printf( LDAP_DEBUG_TRACE, ber->ber_debug, "ber_get_next: tag 0x%lx len %ld contents:\n", ber->ber_tag, ber->ber_len ); ber_log_dump( LDAP_DEBUG_BER, ber->ber_debug, ber, 1 ); +#endif } return (ber->ber_tag); }