From 60bac0c9f558ab34c70f099db923204a84d51ffc Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Fri, 29 Jun 2007 01:59:26 +0000 Subject: The plugger was dying on a HashException it should have caught, and the Logger now allows you to include extra printf formatting in your fields just like the docs say you can. --- src/logger.cpp | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) (limited to 'src/logger.cpp') diff --git a/src/logger.cpp b/src/logger.cpp index 848dfb1..1fc2262 100644 --- a/src/logger.cpp +++ b/src/logger.cpp @@ -71,22 +71,30 @@ void Bu::Logger::setFormat( const Bu::FString &str ) if( *s == '%' ) { sLogFormat += '%'; - s++; - for( int l = 0;; l++ ) + Bu::FString sBuf; + for(;;) { - if( fmts[l][0] == '\0' ) + s++; + int l; + for( l = 0;; l++ ) { - sLogFormat += *s; - break; + if( fmts[l][0] == '\0' ) + { + sBuf += *s; + break; + } + else if( *s == fmts[l][0] ) + { + sLogFormat += fmts[l][2]; + sLogFormat += fmts[l][3]; + sLogFormat += '$'; + sLogFormat += sBuf; + sLogFormat += fmts[l][1]; + break; + } } - else if( *s == fmts[l][0] ) - { - sLogFormat += fmts[l][2]; - sLogFormat += fmts[l][3]; - sLogFormat += '$'; - sLogFormat += fmts[l][1]; + if( fmts[l][0] != '\0' ) break; - } } } else -- cgit v1.2.3