self::getLogMessage( $e ),
self::getLogContext( $e )
);
- $factory->rollbackMasterChanges();
+ $factory->rollbackMasterChanges( __METHOD__ );
}
}
* @param string $message
* @param string $file
* @param int $line
+ * @return bool
*
* @see logError()
*/
return false;
}
-
/**
* Dual purpose callback used as both a set_error_handler() callback and
* a registered shutdown function. Receive a callback from the interpreter
public static function prettyPrintTrace( array $trace, $pad = '' ) {
$text = '';
+ $level = 0;
foreach ( $trace as $level => $frame ) {
if ( isset( $frame['file'] ) && isset( $frame['line'] ) ) {
$text .= "{$pad}#{$level} {$frame['file']}({$frame['line']}): ";
$text .= "{$pad}#{$level} [internal function]: ";
}
- if ( isset( $frame['class'] ) ) {
+ if ( isset( $frame['class'] ) && isset( $frame['type'] ) && isset( $frame['function'] ) ) {
$text .= $frame['class'] . $frame['type'] . $frame['function'];
- } else {
+ } elseif ( isset( $frame['function'] ) ) {
$text .= $frame['function'];
+ } else {
+ $text .= 'NO_FUNCTION_GIVEN';
}
if ( isset( $frame['args'] ) ) {
return "[$id] $url $type from line $line of $file: $message";
}
+ public static function getPublicLogMessage( Exception $e ) {
+ $logId = self::getLogId( $e );
+ $type = get_class( $e );
+ return '[' . $logId . '] '
+ . gmdate( 'Y-m-d H:i:s' ) . ': '
+ . 'Fatal exception of type ' . $type;
+ }
+
/**
* Get a PSR-3 log event context from an Exception.
*