3个版本
0.1.3 | 2022年8月17日 |
---|---|
0.1.2 | 2022年8月17日 |
0.1.1 | 2022年7月22日 |
#8 在 #bitcoind
每月下载 27次
用于 bitcoind-watcher
28KB
553 代码行
☠️⚠️ 进行中 ⚠️☠️
Bitcoind日志解析器
将bitcoind日志解析成合理的数据结构
安装
将包添加到Cargo.toml文件中
[dependencies]
bitcoind-log-parser = "0.1.2"
用法
let bitcoind_log_line = "2022-07-13T15:03:16Z [msghand] New outbound peer connected: version: 70016, blocks=744841, peer=303, peeraddr=15.188.83.52:8333 (block-relay-only)";
// Parse the log line string into a LogLine datastructure
let log_line: LogLine = bitcoind_log_parser::parse(bitcoind_log_line).unwrap();
// Match the type of log line and do something based on it
match &log_line.message {
LogMessage::NewOutboundPeerConnected(_) => {
// do something if the log line represent a new outbound peer connected
println!("{:#?}", &log_line);
}
LogMessage::TransactionAddedToMempool(_) => {
// do something if the log line represent a transaction has been added to the mempool
println!("{:#?}", &log_line);
}
LogMessage::Unknown { raw: _raw } => {
// do something if the log line isn't recognized by bitcoind-log-parser
println!("{:#?}", &log_line);
}
_ => {
println!("{}", line)
}
}
相关
- bitcoind-watcher - 当比特币区块链上发生重要事件时通知您
许可证
MIT © Joe Gesualdo
依赖项
~1MB
~18K SLoC