mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-08 10:53:05 +00:00
Fixed --enable-ansi and --disable-ansi not being respected on threads
this causes some breakage to the behaviour of Terminal, and for that reason this is going on 4.0. Terminal::hasFormattingCodes() will no longer auto-detect whether colour codes are supported.
This commit is contained in:
@ -275,20 +275,18 @@ class MainLogger extends \AttachableThreadedLogger{
|
||||
|
||||
$message = sprintf($this->format, $time->format("H:i:s"), $color, $threadName, $prefix, $message);
|
||||
|
||||
$this->synchronized(function() use ($message, $level, $time) : void{
|
||||
$cleanMessage = TextFormat::clean($message);
|
||||
if(!Terminal::isInit()){
|
||||
Terminal::init($this->mainThreadHasFormattingCodes); //lazy-init 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
|
||||
echo Terminal::toANSI($message) . PHP_EOL;
|
||||
}else{
|
||||
echo $cleanMessage . PHP_EOL;
|
||||
}
|
||||
$this->synchronized(function() use ($message, $level, $time) : void{
|
||||
echo Terminal::toANSI($message) . PHP_EOL;
|
||||
|
||||
foreach($this->attachments as $attachment){
|
||||
$attachment->call($level, $message);
|
||||
}
|
||||
|
||||
$this->logStream[] = $time->format("Y-m-d") . " " . $cleanMessage . PHP_EOL;
|
||||
$this->logStream[] = $time->format("Y-m-d") . " " . TextFormat::clean($message) . PHP_EOL;
|
||||
});
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user