Return to Snippet

Revision: 74278
at October 18, 2018 08:45 by cerxx


Initial Code
<?php 
/*
Plugin Name: Log Error
*/
	if ( ! function_exists('write_log')) {
   function write_log ( $log )  {
      if ( is_array( $log ) || is_object( $log ) ) {
         error_log( print_r( $log, true ) );
      } else {
         error_log( $log );
      }
   }
}
	
	
?>

Initial URL
http://delaemsait.info/primenenie-zhurnala-otladki-v-wordpress/

Initial Description
In certain cases, it is useful to display additional information in a journal that does not report an error, but simply helps in writing your own code. For this PHP provides the function error_log ().
This function does not provide formatting, so you can create your own wrapper over error_log, formatting objects and variables that are written to the log using the print_r () function

Initial Title
Logging debug arbitrary information

Initial Tags
debug, wordpress

Initial Language
PHP