Log schema resources during application startup
This commit logs the number of schema resources that were loaded to create the GraphQL schema, at the INFO level. If DEBUG is enabled for this package, the description of all schema resources will be logged as well. Closes gh-566
This commit is contained in:
@@ -24,6 +24,7 @@ import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.function.BiFunction;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import graphql.language.InterfaceTypeDefinition;
|
||||
import graphql.language.UnionTypeDefinition;
|
||||
@@ -36,6 +37,8 @@ import graphql.schema.idl.SchemaGenerator;
|
||||
import graphql.schema.idl.SchemaParser;
|
||||
import graphql.schema.idl.TypeDefinitionRegistry;
|
||||
import graphql.schema.idl.WiringFactory;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.lang.Nullable;
|
||||
@@ -53,6 +56,8 @@ final class DefaultSchemaResourceGraphQlSourceBuilder
|
||||
extends AbstractGraphQlSourceBuilder<GraphQlSource.SchemaResourceBuilder>
|
||||
implements GraphQlSource.SchemaResourceBuilder {
|
||||
|
||||
private static final Log logger = LogFactory.getLog(DefaultSchemaResourceGraphQlSourceBuilder.class);
|
||||
|
||||
private final Set<Resource> schemaResources = new LinkedHashSet<>();
|
||||
|
||||
private final List<RuntimeWiringConfigurer> runtimeWiringConfigurers = new ArrayList<>();
|
||||
@@ -98,6 +103,14 @@ final class DefaultSchemaResourceGraphQlSourceBuilder
|
||||
.reduce(TypeDefinitionRegistry::merge)
|
||||
.orElseThrow(MissingSchemaException::new);
|
||||
|
||||
logger.info("Loaded " + this.schemaResources.size() + " resource(s) in the GraphQL schema.");
|
||||
if (logger.isDebugEnabled()) {
|
||||
String resources = this.schemaResources.stream()
|
||||
.map(Resource::getDescription)
|
||||
.collect(Collectors.joining(","));
|
||||
logger.debug("Loaded GraphQL schema resources: (" + resources + ")");
|
||||
}
|
||||
|
||||
RuntimeWiring runtimeWiring = initRuntimeWiring();
|
||||
|
||||
TypeResolver typeResolver = initTypeResolver();
|
||||
|
||||
Reference in New Issue
Block a user