From bed74c02ccff82109fd22a536159baf3681d60ec Mon Sep 17 00:00:00 2001 From: Pierangelo Masarati Date: Sat, 10 Jun 2006 17:41:55 +0000 Subject: [PATCH] improve logging --- servers/slapd/back-meta/bind.c | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/servers/slapd/back-meta/bind.c b/servers/slapd/back-meta/bind.c index d761635c68..28fee976a7 100644 --- a/servers/slapd/back-meta/bind.c +++ b/servers/slapd/back-meta/bind.c @@ -852,11 +852,18 @@ meta_back_op_result( rerr = rs->sr_err = slap_map_api2result( rs ); - Debug(LDAP_DEBUG_ANY, - "==> meta_back_op_result[%d] " - "text=\"%s\" matched=\"%s\"\n", - candidate, ( rmsg ? rmsg : "" ), + if ( LogTest( LDAP_DEBUG_ANY ) ) { + char buf[ SLAP_TEXT_BUFLEN ]; + + snprintf( buf, sizeof( buf ), + "meta_back_op_result[%d] " + "err=%d text=\"%s\" matched=\"%s\"", + candidate, rs->sr_err, + ( rmsg ? rmsg : "" ), ( rmatch ? rmatch : "" ) ); + Debug( LDAP_DEBUG_ANY, "%s %s.\n", + op->o_log_prefix, buf, 0 ); + } } if ( META_BACK_TGT_QUARANTINE( mi->mi_targets[ candidate ] ) ) { @@ -895,11 +902,18 @@ meta_back_op_result( rs->sr_err = slap_map_api2result( rs ); - Debug(LDAP_DEBUG_ANY, - "==> meta_back_op_result[%d] " - "text=\"%s\" matched=\"%s\"\n", - i, ( msg ? msg : "" ), - ( match ? match : "" ) ); + if ( LogTest( LDAP_DEBUG_ANY ) ) { + char buf[ SLAP_TEXT_BUFLEN ]; + + snprintf( buf, sizeof( buf ), + "meta_back_op_result[%d] " + "err=%d text=\"%s\" matched=\"%s\"", + candidate, rs->sr_err, + ( rmsg ? rmsg : "" ), + ( rmatch ? rmatch : "" ) ); + Debug( LDAP_DEBUG_ANY, "%s %s.\n", + op->o_log_prefix, buf, 0 ); + } /* * FIXME: need to rewrite "match" (need rwinfo) -- 2.39.5