mirror of
https://github.com/fluencelabs/aquavm
synced 2025-03-16 04:50:49 +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)]
|
#[allow(dead_code)]
|
||||||
// TODO it worth moving it to marine_rs_sdk
|
pub fn json_output_mode(trace_mode: u8) -> bool {
|
||||||
pub fn init_tracing(tracing_params: String, trace_mode: u8) {
|
trace_mode == 0
|
||||||
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();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -63,8 +63,23 @@ pub fn invoke_tracing(
|
|||||||
tracing_params: String,
|
tracing_params: String,
|
||||||
tracing_output_mode: u8,
|
tracing_output_mode: u8,
|
||||||
) -> InterpreterOutcome {
|
) -> InterpreterOutcome {
|
||||||
logger::init_tracing(tracing_params, tracing_output_mode);
|
use tracing::Dispatch;
|
||||||
execute_air(air, prev_data, data, params, call_results)
|
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]
|
#[marine]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user