1
0
mirror of https://github.com/RSS-Bridge/rss-bridge.git synced 2025-07-28 04:10:24 +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:
logmanoriginal
2018-11-10 20:03:03 +01:00
parent 9379854f7a
commit c63af2e7ad
8 changed files with 44 additions and 40 deletions

19
lib/Debug.php Normal file
View File

@@ -0,0 +1,19 @@
<?php
class Debug {
public static function log($text) {
if(!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);
}
}