mirror of
https://github.com/szepeviktor/wordpress-website-lifecycle.git
synced 2025-08-17 18:11:08 +08:00
Improve debug-memory-usage
This commit is contained in:
parent
b6c44ced1a
commit
e14a671776
1 changed files with 11 additions and 1 deletions
|
@ -17,7 +17,17 @@ add_action(
|
|||
? wp_json_encode($_SERVER['REQUEST_URI'], JSON_UNESCAPED_SLASHES)
|
||||
: 'CLI';
|
||||
$message = sprintf('Peak memory usage = %d bytes, %s', $peakUsage, $uri);
|
||||
(defined('WP_CLI') && WP_CLI) ? WP_CLI::debug($message) : error_log($message);
|
||||
switch (true) {
|
||||
case defined('WP_CLI') && WP_CLI:
|
||||
WP_CLI::debug($message);
|
||||
break;
|
||||
case wp_doing_cron() && php_sapi_name() === 'cli':
|
||||
// No output during WP-Cron run from CLI.
|
||||
break;
|
||||
default:
|
||||
error_log($message);
|
||||
break;
|
||||
}
|
||||
},
|
||||
-1,
|
||||
0
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue