aboutsummaryrefslogtreecommitdiffstats
path: root/include/text.php
diff options
context:
space:
mode:
authorredmatrix <redmatrix@redmatrix.me>2015-12-31 12:26:41 -0800
committerredmatrix <redmatrix@redmatrix.me>2015-12-31 12:26:41 -0800
commit2cf4ac26fdde5da6a6845d6c0dd1bb485fee2706 (patch)
tree54c2bba6e3e57b3d43971722e1014bb4d53628be /include/text.php
parent5f61f57b2c1362d9fef8f0390c4095ec30aef382 (diff)
downloadvolse-hubzilla-2cf4ac26fdde5da6a6845d6c0dd1bb485fee2706.tar.gz
volse-hubzilla-2cf4ac26fdde5da6a6845d6c0dd1bb485fee2706.tar.bz2
volse-hubzilla-2cf4ac26fdde5da6a6845d6c0dd1bb485fee2706.zip
log API improvements and queue optimisation for singleton networks
Diffstat (limited to 'include/text.php')
-rw-r--r--include/text.php23
1 files changed, 20 insertions, 3 deletions
diff --git a/include/text.php b/include/text.php
index 4b82343eb..fb8ea3c28 100644
--- a/include/text.php
+++ b/include/text.php
@@ -538,7 +538,7 @@ function attribute_contains($attr, $s) {
* @param int $level A log level.
*/
-function logger($msg, $level = 0) {
+function logger($msg, $level = LOGGER_NORMAL, $priority = LOG_INFO) {
// turn off logger in install mode
global $a;
global $db;
@@ -559,8 +559,8 @@ function logger($msg, $level = 0) {
$where = basename($stack[0]['file']) . ':' . $stack[0]['line'] . ':' . $stack[1]['function'] . ': ';
}
- $s = datetime_convert() . ':' . session_id() . ' ' . $where . $msg . PHP_EOL;
- $pluginfo = array('filename' => $logfile, 'loglevel' => $level, 'message' => $s,'logged' => false);
+ $s = datetime_convert() . ':' . log_priority_str($priority) . ':' . session_id() . ':' . $where . $msg . PHP_EOL;
+ $pluginfo = array('filename' => $logfile, 'loglevel' => $level, 'message' => $s,'priority' => $priority, 'logged' => false);
call_hooks('logger',$pluginfo);
@@ -568,6 +568,23 @@ function logger($msg, $level = 0) {
@file_put_contents($pluginfo['filename'], $pluginfo['message'], FILE_APPEND);
}
+function log_priority_str($priority) {
+ $parr = array(
+ LOG_EMERG => 'LOG_EMERG',
+ LOG_ALERT => 'LOG_ALERT',
+ LOG_CRIT => 'LOG_CRIT',
+ LOG_ERR => 'LOG_ERR',
+ LOG_WARNING => 'LOG_WARNING',
+ LOG_NOTICE => 'LOG_NOTICE',
+ LOG_INFO => 'LOG_INFO',
+ LOG_DEBUG => 'LOG_DEBUG'
+ );
+
+ if($parr[$priority])
+ return $parr[$priority];
+ return 'LOG_UNDEFINED';
+}
+
/**
* @brief This is a special logging facility for developers.
*