diff options
author | Haakon Meland Eriksen <haakon.eriksen@far.no> | 2015-11-16 06:42:08 +0100 |
---|---|---|
committer | Haakon Meland Eriksen <haakon.eriksen@far.no> | 2015-11-16 06:42:08 +0100 |
commit | 69487389d362285aeeb5106097864ec982c08a59 (patch) | |
tree | f5eede7c0a6a5ade0b097b6646f8de2cb33ba5e5 /include/text.php | |
parent | fd5d1416d9a65206879588ff195a8e1d3b49c008 (diff) | |
parent | 0cb5f009b483ff570ded4570bb45023573531494 (diff) | |
download | volse-hubzilla-69487389d362285aeeb5106097864ec982c08a59.tar.gz volse-hubzilla-69487389d362285aeeb5106097864ec982c08a59.tar.bz2 volse-hubzilla-69487389d362285aeeb5106097864ec982c08a59.zip |
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'include/text.php')
-rw-r--r-- | include/text.php | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/include/text.php b/include/text.php index ed0e21a71..4053c15b2 100644 --- a/include/text.php +++ b/include/text.php @@ -531,11 +531,12 @@ function attribute_contains($attr, $s) { * LOGGER_DATA and LOGGER_ALL. * * Since PHP5.4 we get the file, function and line automatically where the logger - * was caleld, so no need to add it to the message anymore. + * was called, so no need to add it to the message anymore. * * @param string $msg Message to log * @param int $level A log level. */ + function logger($msg, $level = 0) { // turn off logger in install mode global $a; @@ -557,7 +558,13 @@ function logger($msg, $level = 0) { $where = basename($stack[0]['file']) . ':' . $stack[0]['line'] . ':' . $stack[1]['function'] . ': '; } - @file_put_contents($logfile, datetime_convert() . ':' . session_id() . ' ' . $where . $msg . PHP_EOL, FILE_APPEND); + $s = datetime_convert() . ':' . session_id() . ' ' . $where . $msg . PHP_EOL; + $pluginfo = array('filename' => $logfile, 'loglevel' => $level, 'message' => $s,'logged' => false); + + call_hooks('logger',$pluginfo); + + if(! $pluginfo['logged']) + @file_put_contents($pluginfo['filename'], $pluginfo['message'], FILE_APPEND); } /** |