Skip to main content

Write to debug.log file.

Home Forums WordPress Config Setup Write to debug.log file.

Tagged: ,

Viewing 0 reply threads
  • Author
    Posts
    • #2376

      Layer7web
      Keymaster

      With define(‘WP_DEBUG_LOG’, true); set in wp-config.php you can write to the debug log from your script with:

      write_log( string );

      if (!function_exists('write_log')) {
          function write_log ( $log )  {
              if ( true === WP_DEBUG ) {
                  if ( is_array( $log ) || is_object( $log ) ) {
                      error_log( print_r( $log, true ) );
                  } else {
                      error_log( $log );
                  }
              }
          }
      }
      • This topic was modified 9 years, 7 months ago by Layer7web.
      • This topic was modified 9 years, 7 months ago by Layer7web.
      • This topic was modified 9 years, 7 months ago by Layer7web.
Viewing 0 reply threads

You must be logged in to reply to this topic.