core: set logger after inited

Signed-off-by: jsvisa <delweng@gmail.com>
jsvisa 3 months ago
parent 44771b39c6
commit 9e1d9ec5d9
  1. 9
      core/blockchain.go

@ -2557,3 +2557,12 @@ func (bc *BlockChain) GetTrieFlushInterval() time.Duration {
func (bc *BlockChain) logger() *tracing.Hooks {
return bc.vmConfig.Tracer
}
// SetLogger sets the blockchain tracer for logging and debugging purposes.
// This method should be called during the initialization phase of the blockchain.
// Note: Setting a logger after the blockchain has started processing blocks may
// result in inconsistent or partial logging. It's recommended to set the logger
// before any block processing occurs.
func (bc *BlockChain) SetLogger(logger *tracing.Hooks) {
bc.vmConfig.Tracer = logger
}

Loading…
Cancel
Save