When an error occurs in the query, the Tracing extension can output the error message.

This commit is contained in:
Sunli 2020-09-26 09:49:46 +08:00
parent 6d5a12ad54
commit c350d182ce

View File

@ -1,5 +1,5 @@
use crate::extensions::{Extension, ResolveInfo};
use crate::Variables;
use crate::{Error, Variables};
use async_graphql_parser::types::ExecutableDocument;
use std::collections::BTreeMap;
use tracing::{span, Level, Span};
@ -116,4 +116,8 @@ impl Extension for Tracing {
span.with_subscriber(|(id, d)| d.exit(id));
}
}
fn error(&mut self, err: &Error) {
tracing::error!(target: "async_graphql::graphql", error = %err);
}
}