Logging

The TF logging functions only log if WP_DEBUG is set to true in wp_config.php.

Aliases for the debug.log file:

  • rd: delete the file
  • vd: vi the file
  • td: tail the file

Log a variable with a comment

usage:
tf_log($label,$message);

>> then search file for $label

[30-Jul-2015 07:19:09 UTC] tf_log: MMM
[30-Jul-2015 07:19:09 UTC] Array
(
[0] => one
[1] => two
)

Generate a stack trace (aka backtrace)

usage:
tf_trace($label);
>> then search file for $label

[30-Jul-2015 07:27:35 UTC] tf_log_trace: MMM

[30-Jul-2015 07:27:35 UTC] #0 get_home_content_xsmall_tpi() called at [/home3/drstan/public_html/ thepactinstitute.com/wp/wp-content/themes/tatkin/includes/functions-home-tpi.php:72]
#1 get_home_content_tpi() called at [/home3/drstan/public_html/thepactinstitute.com/wp/wp-content/themes/ tatkin/page-home-tpi.php:16]
#2 include(/home3/drstan/public_html/thepactinstitute.com/wp/wp-content/themes/tatkin/page-home-tpi.php) called at [/home3/drstan/public_html/thepactinstitute.com/wp/wp-includes/template-loader.php:75]
#3 require_once(/home3/drstan/public_html/thepactinstitute.com/wp/wp-includes/template-loader.php) called at [/home3/drstan/public_html/thepactinstitute.com/wp/wp-blog-header.php:16]
#4 require(/home3/drstan/public_html/thepactinstitute.com/wp/wp-blog-header.php) called at [/home3/drstan/ public_html/thepactinstitute.com/index.php:17]

(See also Gravity Forms logging).