mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-07-29 04:40:19 +02:00
core: Add separate Debug class
Replaces 'debugMessage' by specialized debug function 'Debug::log'. This function takes the same arguments as the previous 'debugMessage'. A separate Debug class allows for further optimization and separation of concern.
This commit is contained in:
@@ -10,19 +10,3 @@ function returnClientError($message){
|
||||
function returnServerError($message){
|
||||
returnError($message, 500);
|
||||
}
|
||||
|
||||
function debugMessage($text){
|
||||
if(!file_exists('DEBUG')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 3);
|
||||
$calling = $backtrace[2];
|
||||
$message = $calling['file'] . ':'
|
||||
. $calling['line'] . ' class '
|
||||
. (isset($calling['class']) ? $calling['class'] : '<no-class>') . '->'
|
||||
. $calling['function'] . ' - '
|
||||
. $text;
|
||||
|
||||
error_log($message);
|
||||
}
|
||||
|
Reference in New Issue
Block a user