Write to STDERR

@param string $message
@param int $status [optional]
@param bool $nl [optional]
356322
final protected function error($message, $status = null, $nl = true)
    {
        $this->io->error($message, $status, $nl);
    }
862758
public function writeError($line, $check, $message, $level = WARNING) {
		$msg = "\t" . $level . " Line:" . $line . ": " . $message . PHP_EOL;
		$this->_write($msg);
	}
201831
public static function stdout($text, $nl = true, $quit = false): void
    {
        self::write($text, $nl, $quit);
    }
1222189
public function writeError($line, $check, $message, $level = WARNING) {
		$errEl = $this->document->createElement("error");
		$errEl->setAttribute("line", $line);
		$errEl->setAttribute("column", "1");
		$errEl->setAttribute("severity", $level);
		$errEl->setAttribute("message", $message);
		$errEl->setAttribute("source", $check);

		if (empty($this->currentElement)) {
			$this->startNewElement("");
		}
		$this->currentElement->appendChild($errEl);
	}
1336874
public static function error($message)
    {
        Craft::$app->controller->stdout($message.PHP_EOL, Console::FG_RED);
    }
1280382
public function stderr(string $text = '', $nl = true): int
    {
        return Console::write($text, $nl, [
            'steam' => $this->errorStream,
        ]);
    }
396912
public function sendError($status = self::HTTP_NOT_FOUND, $message = '')
    {
        if (!is_int($status) || $status < 400 || $status > 505) {
            return;
        }
        
        $this->setBody($message, 'error');
        $this->setStatus($status);
        $this->send();
    }
855526
private function httpout($status, $message = '') {
        status_header($status);
        if ($message) {
            echo $message;
        }

        Response::getInstance()->close();
    }
1281209
public function stdout($msg, $status = self::STATUS_OK)
    {
        $msg = $this->removeColors($msg);
        $msg = $this->replaceEOLs($msg);

        if (defined('STDOUT')) {
            fwrite(STDOUT, $msg);
        } else {
            echo $msg;
            if (count(\ob_get_status()) !== 0) {
                ob_flush();
            }
        }
        return $this;
    }
267316
private function overwrite(string $message): void
    {
        if ($this->overwrite) {
            if (!$this->firstRun) {
                if ($this->output instanceof ConsoleSectionOutput) {
                    $lines = floor(Helper::strlen($message) / $this->terminal->getWidth()) + $this->formatLineCount + 1;
                    $this->output->clear($lines);
                } else {
                    // Erase previous lines
                    if ($this->formatLineCount > 0) {
                        $message = str_repeat("\x1B[1A\x1B[2K", $this->formatLineCount).$message;
                    }

                    // Move the cursor to the beginning of the line and erase the line
                    $message = "\x0D\x1B[2K$message";
                }
            }
        } elseif ($this->step > 0) {
            $message = PHP_EOL.$message;
        }

        $this->firstRun = false;

        $this->output->write($message);
    }
1357807
public static function ajaxResponse($status = 1, $data = [], $message = '')
    {
        $out = [
            'status' => $status,
            'message' => $message,
            'data' => $data,
            'timestamp' => time()
        ];

        echo json_encode($out);
        exit;
    }
243626
public static function log($level, $message)
    {
        if ($level <= self::$logLevel) {
            $level = ($level === 3) ? "debug" : (($level === 2) ? "info" : "warn");
            error_log(sprintf('[%s] tideways - %s', $level, $message), 0);
        }
    }
1261440
public function stderr($msg, $status = self::STATUS_FAIL)
    {
        $msg = "<strong>".$msg."</strong>";
        $msg = $this->removeColors($msg);
        $msg = $this->replaceEOLs($msg);

        if (defined('STDERR')) {
            fwrite(STDERR, $msg);
        } else {
            echo $msg;
            if (count(\ob_get_status()) !== 0) {
                ob_flush();
            }
        }
        return $this;
    }
953954
public static function writeln($message, $quit = false, array $opts = []): int
    {
        return self::write($message, true, $quit, $opts);
    }
320190
public static function readChar(string $message = '', bool $nl = false): string
    {
        $line = self::readln($message, $nl);

        return $line !== '' ? $line[0] : '';
    }
828472
public function stop($status = 0, $message = null) {
		if ($message) {
			($status == 0) ? $this->out($message) : $this->error($message);
		}
		exit($status);
	}
1134259
protected function writeln($msg, $verbosity = OutputInterface::VERBOSITY_NORMAL)
    {
        if ($this->output->getVerbosity() >= $verbosity) {
            $this->output->writeln($msg);
        }
    }