Documentation
¶
Index ¶
- Constants
- func CloseTraceLogger()
- func Flush()
- func InitTraceLogger(enabled bool, logPath string)
- func LogBlock(blockHash string, blockNumber uint64, processID TransactionProcessId)
- func LogBlockWithTimestamp(blockHash string, blockNumber uint64, processID TransactionProcessId, ...)
- func LogTransaction(txHash string, processID TransactionProcessId, blockNumber uint64)
- type TraceLogger
- type TransactionProcessId
Constants ¶
const ( // Fixed chain name CHAIN_NAME = "X Layer" // Fixed business name BUSINESS_NAME = "X Layer" // Fixed chain ID CHAIN_ID = "196" // RPC service name RPC_SERVICE_NAME = "okx-defi-xlayer-rpcpay-pro" // Sequencer service name SEQ_SERVICE_NAME = "okx-defi-xlayer-egseqz-pro" )
const ( // DepositTxType is the transaction type for deposit transactions (system transactions) DepositTxType = 0x7E // Number of log entries to write before forcing a flush FLUSH_INTERVAL_WRITES = 100 // Time interval between flushes (in seconds) FLUSH_INTERVAL_SECONDS = 1 )
Variables ¶
This section is empty.
Functions ¶
func InitTraceLogger ¶
InitTraceLogger initializes the global trace logger When enabled is true, logPath should be provided (default path is set if not specified). All trace logs are written to file only, not to console.
func LogBlock ¶
func LogBlock(blockHash string, blockNumber uint64, processID TransactionProcessId)
LogBlock logs a block event at current time point This matches the reth implementation: log_block(block_hash, block_number, process_id)
func LogBlockWithTimestamp ¶
func LogBlockWithTimestamp(blockHash string, blockNumber uint64, processID TransactionProcessId, timestampMs uint64)
LogBlockWithTimestamp logs a block event with a specific timestamp This matches the reth implementation: log_block_with_timestamp(block_hash, block_number, process_id, timestamp_ms)
func LogTransaction ¶
func LogTransaction(txHash string, processID TransactionProcessId, blockNumber uint64)
LogTransaction logs a transaction event at current time point This matches the reth implementation: log_transaction(tx_hash, process_id, block_number)
Types ¶
type TraceLogger ¶
type TraceLogger struct {
// contains filtered or unexported fields
}
TraceLogger handles transaction trace logging
type TransactionProcessId ¶
type TransactionProcessId uint64
TransactionProcessId represents different stages in the transaction lifecycle These IDs match the reth implementation for consistency
const ( // RPC node: Transaction received and ready to forward RpcReceiveTxEnd TransactionProcessId = 15010 // Sequencer node: Transaction received and added to pool SeqReceiveTxEnd TransactionProcessId = 15030 // Sequencer node: Block building started SeqBlockBuildStart TransactionProcessId = 15032 // Sequencer node: Transaction execution completed SeqTxExecutionEnd TransactionProcessId = 15034 // Sequencer node: Block building completed SeqBlockBuildEnd TransactionProcessId = 15036 // Sequencer node: Block sending started SeqBlockSendStart TransactionProcessId = 15042 // RPC node: Block received from sequencer RpcBlockReceiveEnd TransactionProcessId = 15060 // RPC node: Block insertion completed RpcBlockInsertEnd TransactionProcessId = 15062 )
func (TransactionProcessId) ServiceName ¶
func (p TransactionProcessId) ServiceName() string
ServiceName returns the service name based on the process ID
func (TransactionProcessId) String ¶
func (p TransactionProcessId) String() string
String returns the string representation of the process ID