Log your own debug messages within a WordPress plugin or theme. This will let you record your own information into the debug.log file in WordPress. First, place this function within your plugin or theme:
/** * Log my own debug messages */ function isa_log_my_messages( $message ) { if (WP_DEBUG === true) { if ( is_array( $message) || is_object( $message ) ) { error_log( print_r( $message, true ) ); } else { error_log( $message ); } } }
Then use the function in your code wherever you want to make an entry into the debug log:
isa_log_my_messages( "This is a sample message" );
You can log arrays and objects, as well. For example:
isa_log_my_messages( $some_object ); isa_log_my_messages( $some_array );
Note that this function will only log entries if you have set “WP_DEBUG” to true.
Questions and Comments are Welcome