Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mahara
mahara
Commits
eb6fea58
Commit
eb6fea58
authored
Aug 25, 2009
by
Richard Mansfield
Browse files
Add option to log errors to screen in admin area only
parent
e13ab2cc
Changes
2
Show whitespace changes
Inline
Side-by-side
htdocs/lib/config-defaults.php
View file @
eb6fea58
...
...
@@ -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.
...
...
htdocs/lib/errors.php
View file @
eb6fea58
...
...
@@ -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'
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment