Logger::log - allow specifying errno
bump severity of PDO exception log messages to E_USER_WARNING
This commit is contained in:
parent
3b17c45887
commit
82bc740363
|
@ -30,9 +30,9 @@ class Logger {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function log($string, $context = "") {
|
function log($errno, $errstr, $context = "") {
|
||||||
if ($this->adapter)
|
if ($this->adapter)
|
||||||
return $this->adapter->log_error(E_USER_NOTICE, $string, '', 0, $context);
|
return $this->adapter->log_error($errno, $errstr, '', 0, $context);
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@ class Mailer {
|
||||||
$to_combined = $to_name ? "$to_name <$to_address>" : $to_address;
|
$to_combined = $to_name ? "$to_name <$to_address>" : $to_address;
|
||||||
|
|
||||||
if (defined('_LOG_SENT_MAIL') && _LOG_SENT_MAIL)
|
if (defined('_LOG_SENT_MAIL') && _LOG_SENT_MAIL)
|
||||||
Logger::get()->log("Sending mail from $from_combined to $to_combined [$subject]: $message");
|
Logger::get()->log(E_USER_NOTICE, "Sending mail from $from_combined to $to_combined [$subject]: $message");
|
||||||
|
|
||||||
// HOOK_SEND_MAIL plugin instructions:
|
// HOOK_SEND_MAIL plugin instructions:
|
||||||
// 1. return 1 or true if mail is handled
|
// 1. return 1 or true if mail is handled
|
||||||
|
|
|
@ -176,7 +176,7 @@ class RSSUtils {
|
||||||
|
|
||||||
Debug::log("!! Last error: $error_message");
|
Debug::log("!! Last error: $error_message");
|
||||||
|
|
||||||
Logger::get()->log(
|
Logger::get()->log(E_USER_NOTICE,
|
||||||
sprintf("Update process for feed %d (%s, owner UID: %d) failed with exit code: %d (%s).",
|
sprintf("Update process for feed %d (%s, owner UID: %d) failed with exit code: %d (%s).",
|
||||||
$tline["id"], clean($tline["title"]), $tline["owner_uid"], $exit_code, clean($error_message)));
|
$tline["id"], clean($tline["title"]), $tline["owner_uid"], $exit_code, clean($error_message)));
|
||||||
}
|
}
|
||||||
|
@ -186,7 +186,7 @@ class RSSUtils {
|
||||||
if (!self::update_rss_feed($tline["id"], true)) {
|
if (!self::update_rss_feed($tline["id"], true)) {
|
||||||
global $fetch_last_error;
|
global $fetch_last_error;
|
||||||
|
|
||||||
Logger::get()->log(
|
Logger::get()->log(E_USER_NOTICE,
|
||||||
sprintf("Update request for feed %d (%s, owner UID: %d) failed: %s.",
|
sprintf("Update request for feed %d (%s, owner UID: %d) failed: %s.",
|
||||||
$tline["id"], clean($tline["title"]), $tline["owner_uid"], clean($fetch_last_error)));
|
$tline["id"], clean($tline["title"]), $tline["owner_uid"], clean($fetch_last_error)));
|
||||||
}
|
}
|
||||||
|
@ -194,7 +194,7 @@ class RSSUtils {
|
||||||
Debug::log(sprintf("<= %.4f (sec) (not using a separate process)", microtime(true) - $fstarted));
|
Debug::log(sprintf("<= %.4f (sec) (not using a separate process)", microtime(true) - $fstarted));
|
||||||
|
|
||||||
} catch (PDOException $e) {
|
} catch (PDOException $e) {
|
||||||
Logger::get()->log_error(E_USER_NOTICE, $e->getMessage(), $e->getFile(), $e->getLine(), $e->getTraceAsString());
|
Logger::get()->log_error(E_USER_WARNING, $e->getMessage(), $e->getFile(), $e->getLine(), $e->getTraceAsString());
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$pdo->rollback();
|
$pdo->rollback();
|
||||||
|
|
|
@ -268,7 +268,7 @@
|
||||||
Debug::log(sprintf("Exception while updating feed %d: %s (%s:%d)",
|
Debug::log(sprintf("Exception while updating feed %d: %s (%s:%d)",
|
||||||
$options["update-feed"], $e->getMessage(), $e->getFile(), $e->getLine()));
|
$options["update-feed"], $e->getMessage(), $e->getFile(), $e->getLine()));
|
||||||
|
|
||||||
Logger::get()->log_error(E_USER_NOTICE, $e->getMessage(), $e->getFile(), $e->getLine(), $e->getTraceAsString());
|
Logger::get()->log_error(E_USER_WARNING, $e->getMessage(), $e->getFile(), $e->getLine(), $e->getTraceAsString());
|
||||||
|
|
||||||
exit(110);
|
exit(110);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue