當前位置: 首頁>>編程示例 >>用法及示例精選 >>正文


Bitcoin logging用法及代碼示例

比特幣(Bitcoin) RPC Control API中logging的用法及代碼示例。

用法:

logging ( ["include_category",...] ["exclude_category",...] )

獲取並設置日誌記錄配置。

在不帶參數的情況下調用時,返回狀態列表,這些列表的狀態當前是否已調試記錄。

當使用參數調用時,在調試日誌記錄中添加或刪除類別,並返回上麵的列表。

按照“include”,“exclude”的順序對參數進行求值。

如果一個項目既包含又包含在排除中,則最終將被排除在外。

有效的日誌記錄類別是:net,tor,mempool,http,bench,zmq,db,rpc,estimatefee,addrman,selectcoins,reindex,cmpctblock,rand,prune,proxy,mempoolrej,libevent,coindb,qt,leveldb以下是具有特殊含義的類別名稱:

  • “all”, “1” : represent all logging categories.

  • “none”, “0” : even if other logging categories are specified, ignore all of them.

參數1 - include

類型:json數組,可選

類別的json數組,用於添加調試日誌記錄

[
  "include_category",    (string) the valid logging category
  ...
]

參數2 - exclude

類型:json數組,可選

類別的json數組,以刪除調試日誌記錄

[
  "exclude_category",    (string) the valid logging category
  ...
]

返回結果

{                   (json object where keys are the logging categories, and values indicates its status
  "category": true|false,  (bool) if being debug logged or not. false:inactive, true:active
  ...
}

示例

bitcoin-cli logging "[\"all\"]" "[\"http\"]"
curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "logging", "params": [["all"], ["libevent"]] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/

相關用法


注:本文由純淨天空篩選整理自bitcoin.org大神的英文原創作品 Bitcoin logging。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。