Changing the Server Debug Flag
The following snippets show how to change the Debug Flag for the GraphQL Server execution.
By default, the function callstack trace is not included with errors data unless users are logged in.
If you wanted to track this data on the server, for example, even for public requests, and send the data to a logging service, for example, you could enable the call stack with the following snippet. (Just make sure you _also_ cleanup the errors after the fact so you don’t expose too much data to public users.)
add_action( 'graphql_server_config', function( \GraphQL\Server\ServerConfig $config ) {
$config->setDebugFlag( 1 );
});
Example of the Error Trace when the debug flag is set to 1
There is no callstack trace with the error.
Example of the Error Trace when the debug flag is set to 2
add_action( 'graphql_server_config', function( \GraphQL\Server\ServerConfig $config ) {
$config->setDebugFlag( 2 );
});
There is a callstack trace included with the error.