mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-14 00:22:38 +03:00
Log all error messages if logging is enabled.
FossilOrigin-Name: a8076aede33c07e9a2aaa05be8a888f37b45e41c
This commit is contained in:
@@ -942,21 +942,21 @@ char *sqlite3_snprintf(int n, char *zBuf, const char *zFormat, ...){
|
||||
/*
|
||||
** Format and write a message to the log if logging is enabled.
|
||||
*/
|
||||
void sqlite3_log(int iPriority, const char *zFormat, ...){
|
||||
void sqlite3_log(int iErrCode, const char *zFormat, ...){
|
||||
void (*xLog)(void*, int, const char*); /* The global logger function */
|
||||
void *pLogArg; /* First argument to the logger */
|
||||
va_list ap; /* Vararg list */
|
||||
char *zMsg; /* Complete log message */
|
||||
|
||||
xLog = sqlite3GlobalConfig.xLog;
|
||||
if( xLog ){
|
||||
if( xLog && zFormat ){
|
||||
va_start(ap, zFormat);
|
||||
sqlite3BeginBenignMalloc();
|
||||
zMsg = sqlite3_vmprintf(zFormat, ap);
|
||||
sqlite3EndBenignMalloc();
|
||||
va_end(ap);
|
||||
pLogArg = sqlite3GlobalConfig.pLogArg;
|
||||
xLog(pLogArg, iPriority, zMsg ? zMsg : zFormat);
|
||||
xLog(pLogArg, iErrCode, zMsg ? zMsg : zFormat);
|
||||
sqlite3_free(zMsg);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user