diff options
author | Philip Häusler <msquare@notrademark.de> | 2013-10-13 00:52:44 +0200 |
---|---|---|
committer | Philip Häusler <msquare@notrademark.de> | 2013-10-13 00:52:44 +0200 |
commit | 3c4321ff76accb98ec3c99316766234ebcafae90 (patch) | |
tree | 7461bf942302ec3344a5006f3d40c49963ac28dc /includes/sys_log.php | |
parent | bfb0cacd541cc20129a3c0ac77130370741dca18 (diff) |
30c3 theme
Diffstat (limited to 'includes/sys_log.php')
-rw-r--r-- | includes/sys_log.php | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/includes/sys_log.php b/includes/sys_log.php index 65c0aa41..60c765c0 100644 --- a/includes/sys_log.php +++ b/includes/sys_log.php @@ -1,13 +1,16 @@ <?php /** - * Write a log entry. This should be used to log user's activity. - * @param $message + * Write a log entry. + * This should be used to log user's activity. + * + * @param + * $message */ function engelsystem_log($message) { global $user; - if(isset($user)) { + if (isset($user)) { $nick = $user['Nick']; } else { $nick = "Guest"; @@ -16,4 +19,23 @@ function engelsystem_log($message) { LogEntry_create($nick, $message); } +/** + * Generates a PHP Stacktrace. + */ +function debug_string_backtrace() { + ob_start(); + debug_print_backtrace(); + $trace = ob_get_contents(); + ob_end_clean(); + + // Remove first item from backtrace as it's this function which + // is redundant. + $trace = preg_replace('/^#0\s+' . __FUNCTION__ . "[^\n]*\n/", '', $trace, 1); + + // Renumber backtrace items. + $trace = preg_replace('/^#(\d+)/me', '\'#\' . ($1 - 1)', $trace); + + return $trace; +} + ?>
\ No newline at end of file |