aboutsummaryrefslogtreecommitdiff
path: root/lib/Debug.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Debug.php')
-rw-r--r--lib/Debug.php19
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/Debug.php b/lib/Debug.php
new file mode 100644
index 00000000..7d1f498d
--- /dev/null
+++ b/lib/Debug.php
@@ -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);
+ }
+}