aboutsummaryrefslogtreecommitdiff
path: root/engine/lib
diff options
context:
space:
mode:
authornickw <nickw@36083f99-b078-4883-b0ff-0f9b5a30f544>2009-10-19 17:15:35 +0000
committernickw <nickw@36083f99-b078-4883-b0ff-0f9b5a30f544>2009-10-19 17:15:35 +0000
commitf820b6edcd3b2b22d64aef71b2750253d2bcafcd (patch)
tree564646570801f6e29c2dcf1f325e6ef628cc5ff8 /engine/lib
parent985fad83ae06027c9ba92915b6f253815e7537cc (diff)
downloadelgg-f820b6edcd3b2b22d64aef71b2750253d2bcafcd.tar.gz
elgg-f820b6edcd3b2b22d64aef71b2750253d2bcafcd.tar.bz2
Adding debug options to admin site settings.
Debugging errors and warnings to screen. If notice level is enabled, output is sent to system log file. git-svn-id: http://code.elgg.org/elgg/trunk@3563 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib')
-rw-r--r--engine/lib/elgglib.php30
1 files changed, 21 insertions, 9 deletions
diff --git a/engine/lib/elgglib.php b/engine/lib/elgglib.php
index 36e87eca9..a77922a9f 100644
--- a/engine/lib/elgglib.php
+++ b/engine/lib/elgglib.php
@@ -1752,23 +1752,26 @@ function elgg_log($message, $level='NOTICE') {
// only log when debugging is enabled
if (isset($CONFIG->debug)) {
+ // debug to screen or log?
+ $to_screen = !($CONFIG->debug == 'NOTICE');
+
switch ($level) {
case 'DEBUG':
case 'ERROR':
// always report
- elgg_dump("$level: $message");
+ elgg_dump("$level: $message", $to_screen);
break;
case 'WARNING':
// report execept if user wants only errors
- if ($config->debug != 'ERROR') {
- elgg_dump("$level: $message");
+ if ($CONFIG->debug != 'ERROR') {
+ elgg_dump("$level: $message", $to_screen);
}
break;
case 'NOTICE':
default:
// only report when lowest level is desired
- if ($config->debug == 'NOTICE') {
- elgg_dump("$level: $message");
+ if ($CONFIG->debug == 'NOTICE') {
+ elgg_dump("$level: $message", FALSE);
}
break;
}
@@ -1783,14 +1786,23 @@ function elgg_log($message, $level='NOTICE') {
* Extremely generic var_dump-esque wrapper
*
* Immediately dumps the given $value to the screen as a human-readable string.
+ * The $value can instead be written to the system log through the use of the
+ * $to_screen flag.
*
* @param mixed $value
+ * @param bool $to_screen
* @return void
*/
-function elgg_dump($value) {
- echo '<pre>';
- print_r($value);
- echo '</pre>';
+function elgg_dump($value, $to_screen = TRUE) {
+ if ($to_screen == TRUE) {
+ echo '<pre>';
+ print_r($value);
+ echo '</pre>';
+ }
+ else
+ {
+ error_log($value);
+ }
}
/**