Skip to content

Commit

Permalink
Merge bitcoin#30355: wallet: use LogTrace for walletdb log messages a…
Browse files Browse the repository at this point in the history
…t trace level

46819f5 wallet: use LogTrace for walletdb log messages at trace level (Anthony Towns)

Pull request description:

  Wallet sqlite logging is enabled by `-debug=walletdb -loglevel=walletdb:trace` however the actual log messages are sent at `BCLog::Level::Info`. Switch to the trace level to make this consistent. This adds `[walletdb:trace]` to the log output, eg:

  ```
  [httpworker.3] [wallet/sqlite.cpp:55] [TraceSqlCallback] [/tmp/bitcoin_func_test_4fsnatpg/node0/regtest/wallets/boring/wallet.dat] SQLite Statement: BEGIN EXCLUSIVE TRANSACTION
  ```

  becomes

  ```
  [httpworker.0] [wallet/sqlite.cpp:55] [TraceSqlCallback] [walletdb:trace] [/tmp/bitcoin_func_test_9lcwth4z/node0/regtest/wallets/boring/wallet.dat] SQLite Statement: BEGIN EXCLUSIVE TRANSACTION
  ```

ACKs for top commit:
  maflcko:
    ACK 46819f5
  ryanofsky:
    Code review ACK 46819f5. Nice catch!
  furszy:
    ACK 46819f5
  luke-jr:
    utACK 46819f5

Tree-SHA512: 6fc1bc63c2ee686d4ca8f4f558f06c0cd9e7813b5fce1588351f55ef8bedfc23c97ea443e54a6a447008fa79ea022b6d631cb010929932f1db23fa8e255e6482
  • Loading branch information
ryanofsky authored and PastaPastaPasta committed Oct 30, 2024
1 parent adc58e0 commit a444b1e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/wallet/sqlite.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ static int TraceSqlCallback(unsigned code, void* context, void* param1, void* pa
// in the log file, only expand statements that query the database, not
// statements that update the database.
char* expanded{sqlite3_stmt_readonly(stmt) ? sqlite3_expanded_sql(stmt) : nullptr};
LogPrintf("[%s] SQLite Statement: %s\n", db->Filename(), expanded ? expanded : sqlite3_sql(stmt));
LogTrace(BCLog::WALLETDB, "[%s] SQLite Statement: %s\n", db->Filename(), expanded ? expanded : sqlite3_sql(stmt));
if (expanded) sqlite3_free(expanded);
}
return SQLITE_OK;
Expand Down

0 comments on commit a444b1e

Please sign in to comment.