25 public static function writeLog($e, $errid = null)
27 if ($errid === null) {
28 $errorId = self::$errId;
56 $errLine[] = sprintf(
"[%s] %s> Dynacase got an uncaught exception '%s' with message '%s' in file %s at line %s:", $errorId, $pid, get_class($e) , $e->getMessage() , $e->getFile() , $e->getLine());
58 $errLine[] = self::getUserInfo();
60 if (php_sapi_name() ==
'cli' && is_array($argv)) {
61 $errLine[] = sprintf(
"%s> Command line arguments: %s", $pid, join(
' ', array_map(
"escapeshellarg", $argv)));
62 $errLine[] = sprintf(
"%s> error_log: %s", $pid, ini_get(
'error_log'));
64 foreach (preg_split(
'/\n/', $e->getTraceAsString()) as $line) {
65 $errLine[] = sprintf(
"%s> %s", $pid, $line);
67 $errLine[] = sprintf(
"[%s] %s> End Of Exception.", $errorId, $pid);
68 return implode(
"\n", $errLine);
75 return sprintf(
"User : <%s> \"%s %s\" [%d]", $u->login, $u->firstname, $u->lastname, $u->id);
90 $msg = self::getMessage($e, $errorId, $logMsg);
93 self::writeLogMsg(sprintf(
"[%s] %s", $errorId, $logMsg));
111 public static function getMessage($e, &$errorId, &$logMessage =
"")
114 $errorId = uniqid(
"DCP");
115 self::$errId = $errorId;
118 $logMessage = sprintf(
"%s in %s on line %s", $e[
"message"], $e[
"file"], $e[
"line"]);
119 $logMessage.=
"\n" . self::getUserInfo();
121 $logMessage = $e->getMessage();
124 $displayError = (!empty($action) && $action->getParam(
"CORE_DISPLAY_ERROR") ===
"yes");
126 if (!$displayError) {
127 return sprintf(
"%s.",
___(
"Whoops, looks like something went wrong",
"dcp"));
static formatErrorLogException($e, $errorId="DCP")
if(!function_exists('pgettext')) ___($message, $context="")
static getMessage($e, &$errorId, &$logMessage="")
static writeLog($e, $errid=null)
static logMessage($e, &$errorId)
formatErrorLogException($e)