Skip to content

Commit 9732b7e

Browse files
committed
adjustments to log output
1 parent a277746 commit 9732b7e

2 files changed

Lines changed: 8 additions & 7 deletions

File tree

src/crypto.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,8 @@ void sqlcipher_log(unsigned int tag, const char *message, ...);
312312
#define SQLCIPHER_LOG_WARN 0x02
313313
#define SQLCIPHER_LOG_INFO 0x04
314314
#define SQLCIPHER_LOG_DEBUG 0x08
315-
#define SQLCIPHER_LOG_TRACE 0xffffffff
315+
#define SQLCIPHER_LOG_TRACE 0x10
316+
#define SQLCIPHER_LOG_ALL 0xffffffff
316317

317318
void sqlcipher_vdbe_return_string(Parse*, const char*, const char*, int);
318319

src/crypto_impl.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1727,7 +1727,7 @@ void sqlcipher_log(unsigned int level, const char *message, ...) {
17271727
goto end;
17281728
}
17291729
if(sqlcipher_log_file != NULL){
1730-
char buffer[256];
1730+
char buffer[24];
17311731
struct tm tt;
17321732
int ms;
17331733
time_t sec;
@@ -1746,11 +1746,11 @@ void sqlcipher_log(unsigned int level, const char *message, ...) {
17461746
ms = tv.tv_usec/1000.0;
17471747
localtime_r(&sec, &tt);
17481748
#endif
1749-
sqlcipher_memset(buffer, 0, 256);
1750-
strftime(buffer, sizeof(buffer), "%Y-%m-%d %H:%M:%S", &tt);
1751-
fprintf((FILE*)sqlcipher_log_file, "%s.%03d: ", buffer, ms);
1752-
vfprintf((FILE*)sqlcipher_log_file, message, params);
1753-
fprintf((FILE*)sqlcipher_log_file, "\n");
1749+
if(strftime(buffer, sizeof(buffer), "%Y-%m-%d %H:%M:%S", &tt)) {
1750+
fprintf((FILE*)sqlcipher_log_file, "%s.%03d: ", buffer, ms);
1751+
vfprintf((FILE*)sqlcipher_log_file, message, params);
1752+
fprintf((FILE*)sqlcipher_log_file, "\n");
1753+
}
17541754
}
17551755
#ifdef __ANDROID__
17561756
if(sqlcipher_log_logcat) {

0 commit comments

Comments
 (0)