use crate::{primitives::ExecReturnValue, DispatchError, Weight};
use environmental::environmental;
use sp_core::{H160, H256, U256};
environmental!(tracer: dyn Tracing + 'static);
pub fn trace<R, F: FnOnce() -> R>(tracer: &mut (dyn Tracing + 'static), f: F) -> R {
tracer::using_once(tracer, f)
}
pub(crate) fn if_tracing<F: FnOnce(&mut (dyn Tracing + 'static))>(f: F) {
tracer::with(f);
}
pub trait Tracing {
fn enter_child_span(
&mut self,
_from: H160,
_to: H160,
_is_delegate_call: bool,
_is_read_only: bool,
_value: U256,
_input: &[u8],
_gas: Weight,
) {
}
fn log_event(&mut self, _event: H160, _topics: &[H256], _data: &[u8]) {}
fn exit_child_span(&mut self, _output: &ExecReturnValue, _gas_left: Weight) {}
fn exit_child_span_with_error(&mut self, _error: DispatchError, _gas_left: Weight) {}
}