Project

General

Profile

Bug #18716 ยป bug_8274.diff

Administrator Admin, 2008-04-28 13:56

View differences:

t3lib/class.t3lib_div.php (Arbeitskopie)
*
* @param string Message (in English).
* @param string Extension key (from which extension you are calling the log) or "Core"
* @param integer Severity: 0 is info, 1 is notice, 2 is warning, 3 is error, 4 is fatal error
* @param integer Severity: -1 is debug, 0 is info, 1 is notice, 2 is warning, 3 is error, 4 is fatal error
* @return void
*/
public static function sysLog($msg, $extKey, $severity=0) {
global $TYPO3_CONF_VARS;
$severity = t3lib_div::intInRange($severity,0,4);
$severity = t3lib_div::intInRange($severity,-1,4);
// is message worth logging?
if (intval($TYPO3_CONF_VARS['SYS']['systemLogLevel']) > $severity) return;
......
$msgLine = ' - '.$extKey.': '.$msg;
switch ($severity) {
case -1:
$priority = LOG_DEBUG;
$priorityText = 'DEBUG';
break;
case 0:
$priority = LOG_INFO;
$priorityText = 'INFO';
break;
case 1:
$priority = LOG_NOTICE;
$priorityText = 'NOTICE';
break;
case 2:
$priority = LOG_WARNING;
$priorityText = 'WARNING';
break;
case 3:
$priority = LOG_ERR;
$priorityText = 'ERR';
break;
case 4:
$priority = LOG_CRIT;
$priorityText = 'CRIT';
break;
}
// write message to a file
if ($type == 'file') {
$file = fopen($destination, 'a');
......
mail($to, 'Warning - error in TYPO3 installation',
'Host: '.$TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_div.php']['systemLogHost']."\n".
'Extension: '.$extKey."\n".
'Severity: '.$severity."\n".
'Severity: '.$priorityText."\n".
"\n".$msg,
($from ? 'From: '.$from : '')
);
......
}
// use the system log
elseif ($type == 'syslog') {
$priority = array(LOG_INFO,LOG_NOTICE,LOG_WARNING,LOG_ERR,LOG_CRIT);
syslog($priority[(int)$severity], $msgLine);
syslog($priority, $msgLine);
}
}
}
t3lib/class.t3lib_lock.php (Arbeitskopie)
* Adds a common log entry for this locking API using t3lib_div::sysLog().
* Example: 25-02-08 17:58 - cms: Locking [simple::0aeafd2a67a6bb8b9543fb9ea25ecbe2]: Acquired
*
* @param string $message: The message to be logged
* @param integer $severity: Severity - 0 is info (default), 1 is notice, 2 is warning, 3 is error, 4 is fatal error
* @param string The message to be logged
* @param integer See t3lib_div::sysLog()
* @return void
*/
public function sysLog($message, $severity=0) {
public function sysLog($message, $severity=-1) {
t3lib_div::sysLog('Locking ['.$this->method.'::'.$this->id.']: '.trim($message), 'cms', $severity);
}
}
    (1-1/1)