Skip to content

Debugging and Logging

Q edited this page Aug 17, 2020 · 9 revisions

WP_Debug must be set to true in order to write to log file and the plugin static property $debug OR an external debug control must be set to true + debugging is controlled either on a context, context + task level or directly via template config->debug = true setting

Willow has its own dedicated debug file, called willow.log, which is located in the root or the wp-contents directory.

Enable Global Debugging

Willow load a global context file, located at library/view/context/global.php - this includes top level settings, as follows:

// return an array ##
return [ 'global' 			=> [

	'config'				=> [
		
		// run ALL contexts ##
		'run' 				=> true,
		
		// ALL context debugging ##
		'debug'				=> false,

		// return strategy
		'return'       	 	        => 'echo'

	],

]];

As this file is located in the Q Willow plugin, it is not advised to change this directly, instead create a matching file in your own WP Theme and place it is the same logical position - that is library/view/context/global.php from the root folder of the active parent or child theme - there is no need to include this file directly, Willow should find it.

This is also possible from a plugin, if it has been registered correctly with Willow - Read more

Enable Context Debugging

Enable Debugging per Willow

In the following example, we are enabling debugging for the called Willow:

{~ group~frontpage_work{+ [a] 
	config = debug: true & 
	config->post = {% [r] get_site_option{+ page_on_front +} %} 
+} ~}

The result of this configuration setting will be to include a new key frontpage_work in the debug output, which will include all recorded events in the processing of the function data and output.

Notes:

  • Many aspects of how the debugging process works can be controlled via filters, from the file location to the default log keys to include - in order to understand better how this works, please via the code

Clone this wiki locally