When an error occurs in the query, the Tracing extension can output the error message.
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);
+ }
}
