Skip to content

Automatically add new line

Compare
Choose a tag to compare
@BokuNoMaxi BokuNoMaxi released this 01 Aug 09:15
· 3 commits to main since this release

!!! ATTENTION !!! This works only in TYPO3 12 !!!

Add new feature to automatically add a new line in function "writeLog", this behaviour can be easily toggled depending on use case:

new function call:

 public function writeLog(array|string $msg, bool $newLine = TRUE)
...
 if (is_string($msg)) {
          fwrite($this->fileWriter, $this->timestamp . ": " . $msg);
          $this->addNewLine($newLine);
        } elseif (is_array($msg)) {
          fwrite($this->fileWriter, $this->timestamp . ": " . print_r($msg, true));
          $this->addNewLine($newLine);
...
  private function addNewLine(bool $newLine)
  {
    if($newLine)
      fwrite($this->fileWriter, "\n");
  }