PluginProbe
Smart Grid-Layout Design for Contact Form 7 / 4.14
Smart Grid-Layout Design for Contact Form 7 v4.14
4.18.0 4.17.0 3.2.0 3.2.1 3.3.0 3.3.1 3.3.2 3.3.3 3.3.4 3.3.5 3.3.6 3.3.7 3.3.8 4.0.0 4.0.1 4.1.0 4.1.1 4.1.2 4.1.3 4.1.4 4.10 4.11 4.12 4.13 4.14 All 119 releases
cf7-grid-layout / includes / wordpress-gurus-debug-api.php

wordpress-gurus-debug-api.php in Smart Grid-Layout Design for Contact Form 7 4.14, at includes/wordpress-gurus-debug-api.php

52 lines 1.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Error logging and notices
4 * @since 1.0.0
5 * @var string $message to log if in debug mode
6 */
7 defined('WP_GURUS_DEBUG') || define('WP_GURUS_DEBUG', false);
8
9 if( !function_exists('debug_msg') ){
10 if (true === WP_GURUS_DEBUG) {
11 $debug_msg_last_line='';
12 $debug_msg_last_file='';
13 }
14 /**
15 * Function to log debug messages.
16 * Requires WP_GURUS_DEBUG = true, define it in your wp-config.php file.
17 * Set WP_DEBUG to true, and WP_DEBUG_DISPLAY to false (so no errors are printed to screen), and WP_DEBUG_LOG to true so messages are logged to wp-content/debug.log file.
18 */
19 function debug_msg($message, $prefix='', $trace=0) {
20 if (true === WP_GURUS_DEBUG) {
21 global $debug_msg_last_line,$debug_msg_last_file;
22 $backtrace = debug_backtrace();
23 $file = $backtrace[0]['file'];
24 $line = $backtrace[0]['line'];
25 $files = explode('/',$file);
26 $dirs = explode('/',plugin_dir_path( __FILE__ ));
27 $files = array_diff($files,$dirs);
28 $file = implode('/',$files);
29 $msg='DEBUG_MSG:'.($trace?' --------------- ':'');
30 if (is_array($message) || is_object($message)) {
31 $msg.=$prefix.print_r($message, true);
32 } else {
33 $msg.=$prefix.$message;
34 }
35 if(true===$trace || ($file != $debug_msg_last_file && $line != $debug_msg_last_line)){
36 if($trace===true){
37 $trace = sizeof($backtrace);
38 $msg.=PHP_EOL;
39 }
40 for($idx=($trace-1); $idx>0; $idx--){
41 $msg.='['.$backtrace[$idx]['line'].']->/'.$backtrace[$idx]['file'].PHP_EOL;
42 }
43 $msg.= ($trace?'':PHP_EOL)."/$file:$line";
44 $debug_msg_last_file=$file;
45 $debug_msg_last_line=$line;
46 if($trace) $msg.=PHP_EOL.'-----------------------------------------------------';
47 }
48 error_log($msg);
49 }
50 }
51 } ?>
52