-
Notifications
You must be signed in to change notification settings - Fork 1
Debugging and Logging
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.
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 stratergy
'return' => 'echo'
],
]];
Configuration files are loaded in order as follows:
- Child Theme ( if any and active )
- Parent Theme ( if any and active - if not using child<>parent pair, this will be the current active theme )
- Extensions ( configuration loaded via extended contexts who have defined a lookup value )
- Plugin ( in the current set-up, this is the Q plugin, if active )
- Willow - currently, only the global.php configuration file is shipped with Willow
Configuration is loaded in a contextual sense, based on tags parsed from the current template - debugging options control if this is stored in the wp_options table of the application database, as a transient - or pulled directly from the files ( which is presumably slower, but more direct for debugging purposes, as it avoid any caching ).
The filters that load configuration are located in "library/core/config.php" and run as follows:
// filter Willow Config ##
// Priority -- Q = 1, Q Plugin = 10, Extension = 10, Parent Theme = 100, Child Theme = 1000 ##
\add_filter( 'q/willow/config/load',
function( $args ){
$source = null; // context source ##
return self::filter( $args, $source );
}
, 1, 1 );
\add_filter( 'q/willow/config/load',
function( $args ){
$source = 'plugin'; // context source ##
return self::filter( $args, $source );
}
, 10, 1 );
\add_filter( 'q/willow/config/load',
function( $args ){
$source = 'extend'; // context source ##
return self::filter( $args, $source );
}
, 50, 1 );
\add_filter( 'q/willow/config/load',
function( $args ){
$source = 'parent'; // context source ##
return self::filter( $args, $source );
}
, 100, 1 );
\add_filter( 'q/willow/config/load',
function( $args ){
$source = 'child'; // context source ##
return self::filter( $args, $source );
}
, 1000, 1 );In order to understand the finer details of how load priority works, it would make sense to study the file directly.
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 +} %}
+} ~}