summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'shared/functions/debug.php')
-rw-r--r--shared/functions/debug.php16
1 files changed, 16 insertions, 0 deletions
diff --git a/shared/functions/debug.php b/shared/functions/debug.php
new file mode 100644
index 0000000..4231e21
--- /dev/null
+++ b/shared/functions/debug.php
@@ -0,0 +1,16 @@
+<?php
+function debug ($type, $text=null) {
+ global $conf, $S;
+ if ($conf['debug']) {
+ if ($text===null) {
+ $text=$type;
+ $type=null;
+ }
+ if (defined('STDERR')) { // This is backend, probably
+ fputs(STDERR, (isset($type)?$type.': ':'').$text."\n");
+ } else { // This is probably frontend
+ $S['debug'][]=array($type, $text);
+ }
+ }
+}
+?>