Commit eb6fea58 authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Add option to log errors to screen in admin area only

parent e13ab2cc
......@@ -64,6 +64,8 @@ $cfg = new StdClass;
// For each log level, you can specify where the messages are displayed.
// LOG_TARGET_SCREEN makes the error messages go to the screen - useful
// when debugging but not on a live site!
// LOG_TARGET_ADMIN sends error messages to the screen but only when
// browsing in the admin section
// LOG_TARGET_ERRORLOG makes the error messages go to the log as specified
// by the apache ErrorLog directive. It's probably useful to have this on
// for all log levels.
......
......@@ -36,6 +36,9 @@ define('LOG_TARGET_SCREEN', 1);
define('LOG_TARGET_ERRORLOG', 2);
/** Write the error to stdout (using echo) */
define('LOG_TARGET_STDOUT', 4);
/** Display the errors on the screen in the admin area only (short term hack
until we create an admin notifications page) */
define('LOG_TARGET_ADMIN', 8);
// Logging levels
/** Environment type errors, such as register_globals being on */
......@@ -194,7 +197,7 @@ function log_message ($message, $loglevel, $escape, $backtrace, $file=null, $lin
}
$prefix = '[' . str_pad(substr(strtoupper($loglevelnames[$loglevel]), 0, 3), 3) . '] ' . $prefix;
if ($targets & LOG_TARGET_SCREEN) {
if ($targets & LOG_TARGET_SCREEN || (defined('ADMIN') && $targets & LOG_TARGET_ADMIN)) {
// Work out which method to call for displaying the message
if ($loglevel == LOG_LEVEL_DBG || $loglevel == LOG_LEVEL_INFO) {
$method = 'add_info_msg';
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment