mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-07 10:41:40 +09:00
Add unit tests for the Debug class
This commit is contained in:
parent
3045ac9c42
commit
0947bafa66
2 changed files with 82 additions and 6 deletions
|
|
@ -18,6 +18,11 @@ class Debug
|
|||
protected static $_slow_triggers = array();
|
||||
protected static $_slow_widgets = array();
|
||||
|
||||
/**
|
||||
* Also write to error log.
|
||||
*/
|
||||
public static $write_to_error_log = true;
|
||||
|
||||
/**
|
||||
* Get all entries.
|
||||
*
|
||||
|
|
@ -118,9 +123,12 @@ class Debug
|
|||
self::$_entries[] = $entry;
|
||||
|
||||
// Add the entry to the error log.
|
||||
$log_entry = str_replace("\0", '', sprintf('Rhymix Debug: %s in %s on line %d',
|
||||
var_export($message, true), $entry->file, $entry->line));
|
||||
error_log($log_entry);
|
||||
if (self::$write_to_error_log)
|
||||
{
|
||||
$log_entry = str_replace("\0", '', sprintf('Rhymix Debug: %s in %s on line %d',
|
||||
var_export($message, true), $entry->file, $entry->line));
|
||||
error_log($log_entry);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -165,9 +173,12 @@ class Debug
|
|||
);
|
||||
|
||||
// Add the entry to the error log.
|
||||
$log_entry = str_replace("\0", '', sprintf('PHP %s: %s in %s on line %d',
|
||||
$errinfo->type, $errstr, $errfile, intval($errline)));
|
||||
error_log($log_entry);
|
||||
if (self::$write_to_error_log)
|
||||
{
|
||||
$log_entry = str_replace("\0", '', sprintf('PHP %s: %s in %s on line %d',
|
||||
$errinfo->type, $errstr, $errfile, intval($errline)));
|
||||
error_log($log_entry);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue