original_string: public function log($message, $type = "MESSAGE", $text_attributes = [])
      {
  
          $type = strtoupper($type);
  
          switch ($type) {
  
              case 'RAW':
                  break;
  
              case 'ERROR':
                  $this->number_of_errors++;
                  $this->onError($message);
              default:
                  $message = $type . ': ' . $message;
          }
          
          $this->logToFile($message);
          
          if(empty($text_attributes)){
              file_put_contents("php://stdout", "\n".$message);
              return $message;
          }
          
          if(is_array($text_attributes)){
              if(isset($text_attributes['bold']) && $text_attributes['bold']){
                  file_put_contents("php://stdout", "\033[1m");
              }
  
              if(isset($text_attributes['underline']) && $text_attributes['underline']){
                  file_put_contents("php://stdout","\033[4m");
              }
  
              if(isset($text_attributes['fgcolor']) && isset($this->fgcolors[$text_attributes['fgcolor']])){
                  file_put_contents("php://stdout", "\033[".$this->fgcolors[$text_attributes['fgcolor']]."m");
              }
  
              if(isset($text_attributes['bgcolor']) && isset($this->fgcolors[$text_attributes['bgcolor']])){
                 file_put_contents("php://stdout", "\033[".$this->bgcolors[$bgcolor]."m");
              }
  
              if(isset($text_attributes['underline']) && $text_attributes['underline']){
                  file_put_contents("php://stdout","\033[4m");
              }
  
              if(isset($text_attributes['overwrite']) && $text_attributes['overwrite']){
                  file_put_contents("php://stdout", "\033[2K\033[A");
              }
          } else if(is_string($text_attributes) && isset($this->fgcolors[$text_attributes])){
              file_put_contents("php://stdout", "\033[".$this->fgcolors[$text_attributes]."m");
          }
          
  
          file_put_contents("php://stdout", "\n".$message);
  
          if(!is_array($text_attributes) || !isset($text_attributes['keep']) || !$text_attributes['keep']){
              file_put_contents("php://stdout","\033[0m");
          }
  
          return $message;
      }
code: public function log($message, $type = "MESSAGE", $text_attributes = [])
      {
  
          $type = strtoupper($type);
  
          switch ($type) {
  
              case 'RAW':
                  break;
  
              case 'ERROR':
                  $this->number_of_errors++;
                  $this->onError($message);
              default:
                  $message = $type . ': ' . $message;
          }
          
          $this->logToFile($message);
          
          if(empty($text_attributes)){
              file_put_contents("php://stdout", "\n".$message);
              return $message;
          }
          
          if(is_array($text_attributes)){
              if(isset($text_attributes['bold']) && $text_attributes['bold']){
                  file_put_contents("php://stdout", "\033[1m");
              }
  
              if(isset($text_attributes['underline']) && $text_attributes['underline']){
                  file_put_contents("php://stdout","\033[4m");
              }
  
              if(isset($text_attributes['fgcolor']) && isset($this->fgcolors[$text_attributes['fgcolor']])){
                  file_put_contents("php://stdout", "\033[".$this->fgcolors[$text_attributes['fgcolor']]."m");
              }
  
              if(isset($text_attributes['bgcolor']) && isset($this->fgcolors[$text_attributes['bgcolor']])){
                 file_put_contents("php://stdout", "\033[".$this->bgcolors[$bgcolor]."m");
              }
  
              if(isset($text_attributes['underline']) && $text_attributes['underline']){
                  file_put_contents("php://stdout","\033[4m");
              }
  
              if(isset($text_attributes['overwrite']) && $text_attributes['overwrite']){
                  file_put_contents("php://stdout", "\033[2K\033[A");
              }
          } else if(is_string($text_attributes) && isset($this->fgcolors[$text_attributes])){
              file_put_contents("php://stdout", "\033[".$this->fgcolors[$text_attributes]."m");
          }
          
  
          file_put_contents("php://stdout", "\n".$message);
  
          if(!is_array($text_attributes) || !isset($text_attributes['keep']) || !$text_attributes['keep']){
              file_put_contents("php://stdout","\033[0m");
          }
  
          return $message;
      }
code_tokens: public function log ( $ message , $ type = "MESSAGE" , $ text_attributes = [ ] ) { $ type = strtoupper ( $ type ) ; switch ( $ type ) { case 'RAW' : break ; case 'ERROR' : $ this -> number_of_errors ++ ; $ this -> onError ( $ message ) ; default : $ message = $ type . ': ' . $ message ; } $ this -> logToFile ( $ message ) ; if ( empty ( $ text_attributes ) ) { file_put_contents ( "php://stdout" , "\n" . $ message ) ; return $ message ; } if ( is_array ( $ text_attributes ) ) { if ( isset ( $ text_attributes [ 'bold' ] ) && $ text_attributes [ 'bold' ] ) { file_put_contents ( "php://stdout" , "\033[1m" ) ; } if ( isset ( $ text_attributes [ 'underline' ] ) && $ text_attributes [ 'underline' ] ) { file_put_contents ( "php://stdout" , "\033[4m" ) ; } if ( isset ( $ text_attributes [ 'fgcolor' ] ) && isset ( $ this -> fgcolors [ $ text_attributes [ 'fgcolor' ] ] ) ) { file_put_contents ( "php://stdout" , "\033[" . $ this -> fgcolors [ $ text_attributes [ 'fgcolor' ] ] . "m" ) ; } if ( isset ( $ text_attributes [ 'bgcolor' ] ) && isset ( $ this -> fgcolors [ $ text_attributes [ 'bgcolor' ] ] ) ) { file_put_contents ( "php://stdout" , "\033[" . $ this -> bgcolors [ $ bgcolor ] . "m" ) ; } if ( isset ( $ text_attributes [ 'underline' ] ) && $ text_attributes [ 'underline' ] ) { file_put_contents ( "php://stdout" , "\033[4m" ) ; } if ( isset ( $ text_attributes [ 'overwrite' ] ) && $ text_attributes [ 'overwrite' ] ) { file_put_contents ( "php://stdout" , "\033[2K\033[A" ) ; } } else if ( is_string ( $ text_attributes ) && isset ( $ this -> fgcolors [ $ text_attributes ] ) ) { file_put_contents ( "php://stdout" , "\033[" . $ this -> fgcolors [ $ text_attributes ] . "m" ) ; } file_put_contents ( "php://stdout" , "\n" . $ message ) ; if ( ! is_array ( $ text_attributes ) || ! isset ( $ text_attributes [ 'keep' ] ) || ! $ text_attributes [ 'keep' ] ) { file_put_contents ( "php://stdout" , "\033[0m" ) ; } return $ message ; }
docstring: Logs to std out
  @param string $message The message of the line
  @param string $type The prefix of the line, if ERROR, encrements error count
  @param array|string $text_attributes, used to describe how output should look
  e.g. ['fgcolor' => 'red', 'bgcolor' => 'yellow', 'bold' => true, 'underline' => true, 'keep' => false]
  if keep is true then it keeps the style until you call a line with another
  style or you call $this->setNormalText()
  if string then its just the foreground color
docstring_tokens: Logs to std out