Merge branch 'release/3.2'

This commit is contained in:
Dylan K. Taylor 2018-08-03 18:50:37 +01:00
commit 2170411cf8

View File

@ -204,10 +204,16 @@ class MainLogger extends \AttachableThreadedLogger{
$errno = $errorConversion[$errno] ?? $errno; $errno = $errorConversion[$errno] ?? $errno;
$errstr = preg_replace('/\s+/', ' ', trim($errstr)); $errstr = preg_replace('/\s+/', ' ', trim($errstr));
$errfile = Utils::cleanPath($errfile); $errfile = Utils::cleanPath($errfile);
$this->log($type, get_class($e) . ": \"$errstr\" ($errno) in \"$errfile\" at line $errline");
foreach(Utils::getTrace(0, $trace) as $i => $line){ $message = get_class($e) . ": \"$errstr\" ($errno) in \"$errfile\" at line $errline";
$stack = Utils::getTrace(0, $trace);
$this->synchronized(function() use ($type, $message, $stack) : void{
$this->log($type, $message);
foreach($stack as $line){
$this->debug($line, true); $this->debug($line, true);
} }
});
$this->syncFlushBuffer(); $this->syncFlushBuffer();
} }
@ -259,6 +265,8 @@ class MainLogger extends \AttachableThreadedLogger{
} }
$message = sprintf($this->format, date("H:i:s", $now), $color, $threadName, $prefix, $message); $message = sprintf($this->format, date("H:i:s", $now), $color, $threadName, $prefix, $message);
$this->synchronized(function() use ($message, $level, $now) : void{
$cleanMessage = TextFormat::clean($message); $cleanMessage = TextFormat::clean($message);
if($this->mainThreadHasFormattingCodes and Terminal::hasFormattingCodes()){ //hasFormattingCodes() lazy-inits colour codes because we don't know if they've been registered on this thread if($this->mainThreadHasFormattingCodes and Terminal::hasFormattingCodes()){ //hasFormattingCodes() lazy-inits colour codes because we don't know if they've been registered on this thread
@ -272,6 +280,7 @@ class MainLogger extends \AttachableThreadedLogger{
} }
$this->logStream[] = date("Y-m-d", $now) . " " . $cleanMessage . PHP_EOL; $this->logStream[] = date("Y-m-d", $now) . " " . $cleanMessage . PHP_EOL;
});
} }
public function syncFlushBuffer(){ public function syncFlushBuffer(){