diff options
Diffstat (limited to 'src/logger.cpp')
-rw-r--r-- | src/logger.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/logger.cpp b/src/logger.cpp index fe6a916..91679ff 100644 --- a/src/logger.cpp +++ b/src/logger.cpp | |||
@@ -20,7 +20,11 @@ void Bu::Logger::log( uint32_t nLevel, const char *sFile, const char *sFunction, | |||
20 | va_list ap; | 20 | va_list ap; |
21 | va_start( ap, sFormat ); | 21 | va_start( ap, sFormat ); |
22 | char *text; | 22 | char *text; |
23 | vasprintf( &text, sFormat, ap ); | 23 | if( vasprintf( &text, sFormat, ap ) < 0 ) |
24 | { | ||
25 | printf("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! WTF?\n"); | ||
26 | return; | ||
27 | } | ||
24 | va_end(ap); | 28 | va_end(ap); |
25 | 29 | ||
26 | time_t t = time(NULL); | 30 | time_t t = time(NULL); |
@@ -152,6 +156,11 @@ void Bu::Logger::hexDump( uint32_t nLevel, const char *sFile, | |||
152 | Bu::FString sLine; | 156 | Bu::FString sLine; |
153 | for(;;) | 157 | for(;;) |
154 | { | 158 | { |
159 | { | ||
160 | char buf[15]; | ||
161 | sprintf( buf, "%010d| ", j ); | ||
162 | sLine += buf; | ||
163 | } | ||
155 | int kmax = 8; | 164 | int kmax = 8; |
156 | if( nDataLen-j < 8 ) kmax = nDataLen-j; | 165 | if( nDataLen-j < 8 ) kmax = nDataLen-j; |
157 | for(int k = 0; k < 8; k++ ) | 166 | for(int k = 0; k < 8; k++ ) |
@@ -171,7 +180,7 @@ void Bu::Logger::hexDump( uint32_t nLevel, const char *sFile, | |||
171 | for(int k = 0; k < kmax; k++ ) | 180 | for(int k = 0; k < kmax; k++ ) |
172 | { | 181 | { |
173 | char buf[3]; | 182 | char buf[3]; |
174 | sprintf( buf, "%c ", (pData[j+k]>32 && pData[j+k]<=128)?(pData[j+k]):('.') ); | 183 | sprintf( buf, "%c", (pData[j+k]>32 && pData[j+k]<=128)?(pData[j+k]):('.') ); |
175 | sLine += buf; | 184 | sLine += buf; |
176 | } | 185 | } |
177 | log( nLevel, sFile, sFunction, nLine, sLine.getStr() ); | 186 | log( nLevel, sFile, sFunction, nLine, sLine.getStr() ); |