Merge pull request #2666 from annando/1607-more-logging
Logging for feeds improved, new "process id" for logging
This commit is contained in:
commit
b4b2a6d5b8
4 changed files with 21 additions and 4 deletions
4
boot.php
4
boot.php
|
@ -517,6 +517,8 @@ class App {
|
||||||
*/
|
*/
|
||||||
public $template_engine_instance = array();
|
public $template_engine_instance = array();
|
||||||
|
|
||||||
|
public $process_id;
|
||||||
|
|
||||||
private $ldelim = array(
|
private $ldelim = array(
|
||||||
'internal' => '',
|
'internal' => '',
|
||||||
'smarty3' => '{{'
|
'smarty3' => '{{'
|
||||||
|
@ -577,6 +579,8 @@ class App {
|
||||||
|
|
||||||
$this->query_string = '';
|
$this->query_string = '';
|
||||||
|
|
||||||
|
$this->process_id = uniqid("log", true);
|
||||||
|
|
||||||
startup();
|
startup();
|
||||||
|
|
||||||
set_include_path(
|
set_include_path(
|
||||||
|
|
|
@ -1140,6 +1140,7 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true, $simplehtml = fal
|
||||||
$Text = preg_replace("/\[event\-finish\](.*?)\[\/event\-finish\]/ism",'',$Text);
|
$Text = preg_replace("/\[event\-finish\](.*?)\[\/event\-finish\]/ism",'',$Text);
|
||||||
$Text = preg_replace("/\[event\-location\](.*?)\[\/event\-location\]/ism",'',$Text);
|
$Text = preg_replace("/\[event\-location\](.*?)\[\/event\-location\]/ism",'',$Text);
|
||||||
$Text = preg_replace("/\[event\-adjust\](.*?)\[\/event\-adjust\]/ism",'',$Text);
|
$Text = preg_replace("/\[event\-adjust\](.*?)\[\/event\-adjust\]/ism",'',$Text);
|
||||||
|
$Text = preg_replace("/\[event\-id\](.*?)\[\/event\-id\]/ism",'',$Text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -17,10 +17,15 @@ function feed_import($xml,$importer,&$contact, &$hub, $simulate = false) {
|
||||||
|
|
||||||
$a = get_app();
|
$a = get_app();
|
||||||
|
|
||||||
logger("Import Atom/RSS feed", LOGGER_DEBUG);
|
if (!$simulate)
|
||||||
|
logger("Import Atom/RSS feed '".$contact["name"]."' (Contact ".$contact["id"].") for user ".$importer["uid"], LOGGER_DEBUG);
|
||||||
|
else
|
||||||
|
logger("Test Atom/RSS feed", LOGGER_DEBUG);
|
||||||
|
|
||||||
if ($xml == "")
|
if ($xml == "") {
|
||||||
|
logger('XML is empty.', LOGGER_DEBUG);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$doc = new DOMDocument();
|
$doc = new DOMDocument();
|
||||||
@$doc->loadXML($xml);
|
@$doc->loadXML($xml);
|
||||||
|
@ -150,8 +155,10 @@ function feed_import($xml,$importer,&$contact, &$hub, $simulate = false) {
|
||||||
$header["last-child"] = 0;
|
$header["last-child"] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is_object($entries))
|
if (!is_object($entries)) {
|
||||||
|
logger("There are no entries in this feed.", LOGGER_DEBUG);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$items = array();
|
$items = array();
|
||||||
|
|
||||||
|
|
|
@ -717,10 +717,15 @@ function logger($msg,$level = 0) {
|
||||||
if((! $debugging) || (! $logfile) || ($level > $loglevel))
|
if((! $debugging) || (! $logfile) || ($level > $loglevel))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
$process_id = session_id();
|
||||||
|
|
||||||
|
if ($process_id == "")
|
||||||
|
$process_id = get_app()->process_id;
|
||||||
|
|
||||||
$callers = debug_backtrace();
|
$callers = debug_backtrace();
|
||||||
$logline = sprintf("%s@%s\t[%s]:%s:%s:%s\t%s\n",
|
$logline = sprintf("%s@%s\t[%s]:%s:%s:%s\t%s\n",
|
||||||
datetime_convert(),
|
datetime_convert(),
|
||||||
session_id(),
|
$process_id,
|
||||||
$LOGGER_LEVELS[$level],
|
$LOGGER_LEVELS[$level],
|
||||||
basename($callers[0]['file']),
|
basename($callers[0]['file']),
|
||||||
$callers[0]['line'],
|
$callers[0]['line'],
|
||||||
|
|
Loading…
Reference in a new issue