mirror of
https://github.com/fluencelabs/aquavm
synced 2024-12-04 23:20:18 +00:00
fix(air-interpreter): enable multiple invoke_tracing calls for air-interpreter (#753)
This commit is contained in:
parent
1b7de5e659
commit
938e5eb033
@ -32,18 +32,6 @@ pub fn init_logger(default_level: Option<LevelFilter>) {
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
// TODO it worth moving it to marine_rs_sdk
|
||||
pub fn init_tracing(tracing_params: String, trace_mode: u8) {
|
||||
use tracing_subscriber::fmt::format::FmtSpan;
|
||||
|
||||
let builder = tracing_subscriber::fmt()
|
||||
.with_env_filter(tracing_params)
|
||||
.with_span_events(FmtSpan::ENTER | FmtSpan::CLOSE)
|
||||
.with_writer(std::io::stderr);
|
||||
if trace_mode == 0 {
|
||||
builder.json().init();
|
||||
} else {
|
||||
// Human-readable output.
|
||||
builder.init();
|
||||
}
|
||||
pub fn json_output_mode(trace_mode: u8) -> bool {
|
||||
trace_mode == 0
|
||||
}
|
||||
|
@ -63,8 +63,23 @@ pub fn invoke_tracing(
|
||||
tracing_params: String,
|
||||
tracing_output_mode: u8,
|
||||
) -> InterpreterOutcome {
|
||||
logger::init_tracing(tracing_params, tracing_output_mode);
|
||||
execute_air(air, prev_data, data, params, call_results)
|
||||
use tracing::Dispatch;
|
||||
use tracing_subscriber::fmt::format::FmtSpan;
|
||||
|
||||
let builder = tracing_subscriber::fmt()
|
||||
.with_env_filter(tracing_params)
|
||||
.with_span_events(FmtSpan::ENTER | FmtSpan::CLOSE)
|
||||
.with_writer(std::io::stderr);
|
||||
|
||||
let dispatch = if logger::json_output_mode(tracing_output_mode) {
|
||||
let subscriber = builder.json().finish();
|
||||
Dispatch::new(subscriber)
|
||||
} else {
|
||||
// Human-readable output.
|
||||
let subscriber = builder.finish();
|
||||
Dispatch::new(subscriber)
|
||||
};
|
||||
tracing::dispatcher::with_default(&dispatch, || execute_air(air, prev_data, data, params, call_results))
|
||||
}
|
||||
|
||||
#[marine]
|
||||
|
Loading…
Reference in New Issue
Block a user