Write content to file if output medium is not set to <code>MEDIUM_STDOUT</code>
and return the content of logger.

@return string content of logger
@throws Exception
961521
public function log()
    {
        if (isCLI()) {
            $message = $this->getContentForFile();
            $this->writeToLogFile($message);
            return $message;
        } else {
            if ($this->outputMedium !== static::MEDIUM_STDOUT) {
                $this->writeToLogFile($this->getContentForFile());
            }

            if ($this->outputMedium !== static::MEDIUM_FILE) {
                return $this->getResponse();
            }
        }
    }
716254
public function read()
    {
        $result = '';
        $ht = $this->getHTaccessFilename();
        $fs = $this->getFilesystem();
        if (@$fs->isFile($ht)) {
            $result = @$fs->get($ht);
            if ($result === false) {
                throw new Exception("Failed to read from file $ht");
            }
        }

        return $result;
    }
474988
public function sendContent()
    {
        if (!$this->isSuccessful()) {
            return parent::sendContent();
        }

        if (0 === $this->maxlen) {
            return $this;
        }

        $out = fopen('php://output', 'wb');
        $file = fopen($this->file->getPathname(), 'rb');

        stream_copy_to_stream($file, $out, $this->maxlen, $this->offset);

        fclose($out);
        fclose($file);

        if ($this->deleteFileAfterSend && file_exists($this->file->getPathname())) {
            unlink($this->file->getPathname());
        }

        return $this;
    }
319094
protected function write()
    {
        if (!isset($this->pipes[0])) {
            return;
        }
        $input = $this->input;

        if ($input instanceof \Iterator) {
            if (!$input->valid()) {
                $input = null;
            } elseif (is_resource($input = $input->current())) {
                stream_set_blocking($input, 0);
            } elseif (!isset($this->inputBuffer[0])) {
                if (!is_string($input)) {
                    if (!is_scalar($input)) {
                        throw new InvalidArgumentException(sprintf('%s yielded a value of type "%s", but only scalars and stream resources are supported', get_class($this->input), gettype($input)));
                    }
                    $input = (string) $input;
                }
                $this->inputBuffer = $input;
                $this->input->next();
                $input = null;
            } else {
                $input = null;
            }
        }

        $r = $e = array();
        $w = array($this->pipes[0]);

        // let's have a look if something changed in streams
        if (false === $n = @stream_select($r, $w, $e, 0, 0)) {
            return;
        }

        foreach ($w as $stdin) {
            if (isset($this->inputBuffer[0])) {
                $written = fwrite($stdin, $this->inputBuffer);
                $this->inputBuffer = substr($this->inputBuffer, $written);
                if (isset($this->inputBuffer[0])) {
                    return array($this->pipes[0]);
                }
            }

            if ($input) {
                for (;;) {
                    $data = fread($input, self::CHUNK_SIZE);
                    if (!isset($data[0])) {
                        break;
                    }
                    $written = fwrite($stdin, $data);
                    $data = substr($data, $written);
                    if (isset($data[0])) {
                        $this->inputBuffer = $data;

                        return array($this->pipes[0]);
                    }
                }
                if (feof($input)) {
                    if ($this->input instanceof \Iterator) {
                        $this->input->next();
                    } else {
                        $this->input = null;
                    }
                }
            }
        }

        // no input to read on resource, buffer is empty
        if (!isset($this->inputBuffer[0]) && !($this->input instanceof \Iterator ? $this->input->valid() : $this->input)) {
            $this->input = null;
            fclose($this->pipes[0]);
            unset($this->pipes[0]);
        } elseif (!$w) {
            return array($this->pipes[0]);
        }
    }
220577
public function sendContent()
    {
        if (!$this->isSuccessful()) {
            return parent::sendContent();
        }

        if (0 === $this->maxlen) {
            return $this;
        }

        $out = fopen('php://output', 'wb');
        $file = $this->filesystem->readStream($this->file->getPath());
        stream_copy_to_stream($file, $out, $this->maxlen, $this->offset);

        fclose($out);
        fclose($file);

        return $this;
    }
899398
public function getOutput() {
		// create stream handle for the output
		$handle = fopen('php://temp/maxmemory:'.(1*1024*1024), 'r+'); // 1MB

		if (is_null($this->callback)) $this->callback = $_REQUEST['callback'];

		fwrite($handle, $this->callback . '(');
		fwrite($handle, json_encode($this->_content['content']));
		fwrite($handle, ');');
		return $handle;
	}
604905
public void write() throws Exception {
    PrintWriter out;
    String output = output();

    if (outFile != null) {
      out = new PrintWriter(Files.newBufferedWriter(outFile.toPath(), UTF_8));
    } else if (inPlace) {
      assert docFile != null
          : "@AssumeAssertion(nullness): dependent: docFile is non-null if inPlace is true";
      out = new PrintWriter(Files.newBufferedWriter(docFile.toPath(), UTF_8));
    } else {
      out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out, UTF_8)));
    }

    out.println(output);
    out.flush();
    out.close();
  }
1297385
public function getContent() {
        $content = "";
        $maxLen = 0;

        foreach ($this->logs as $log)
            if ($log[0]) {
                $name = $log[0]->getFeature()->getName();
                $maxLen = strlen($name) > $maxLen ? strlen($name) : $maxLen;
            }
        
        foreach ($this->logs as $log)
            $content .= sprintf("%-{$maxLen}s | $log[1]\n", $log[0] ? $log[0]->getFeature()->getName() : "");
        
        return new TextFileContent($content);
    }
1005550
public function flush()
    {
        if (false !== $many = $this->put($this->_stringBuffer, FILE_APPEND)) {
            $this->_stringBuffer = "";
            return $many;
        }
        throw new Exception("文件写入失败+", 100100302);
    }
1035442
private static void writeToLog(Logger logger, Level level, String pattern, Exception exception) {
    if (level == Level.ERROR) {
      logger.error(pattern, exception);
    } else if (level == Level.INFO) {
      logger.info(pattern);
    } else if (level == Level.DEBUG) {
      logger.debug(pattern);
    }
  }
726725
public function write()
    {
        // If the local filesystem has the uploaded file
        if (file_exists($this->file->getRealPath()))
        {
            // Read the local uploaded file
            $file = file_get_contents($this->file->getRealPath());

            // Write it to the S3 location
            return $this->remote->write($this->attributes['upload_to'] . '/' . $this->attributes['filename'], $file, ['visibility' => 'public']);
        }

        throw new Exception('The uploaded file was not found on the filesystem');
    }
332856
public function execute()
    {
        $this->unixParams();
        $output = [];
        $return_var = 0;

        exec($this->the_command, $output, $return_var);

        if ($return_var !== 0) {
            throw new Exception(
                'Your report has an error and couldn\'t be processed! Try to output the command: '.
                escapeshellcmd($this->the_command),
                1
            );
        }

        return $output;
    }
55187
public function getExceptionLogFileContent()
    {
        $fileCreated = false;
        
        /** Suppress the warning, which is emitted, if the file does not exist */
        if ($fileDoesNotExist = !@file_exists($this->exceptionLogFile)) {
            $fileCreated = touch($this->exceptionLogFile);
        }
        if ($fileDoesNotExist && !$fileCreated) {
            throw new \OxidEsales\Eshop\Core\Exception\StandardException('Empty file ' . $this->exceptionLogFile . ' could not have been be created');
        }

        $logFileContent = file_get_contents($this->exceptionLogFile);
        if (false === $logFileContent) {
            throw new \OxidEsales\Eshop\Core\Exception\StandardException('File ' . $this->exceptionLogFile . ' could not be read');
        }

        return $logFileContent;
    }
354387
public function getContentId() {
		if (!$this->id) {
			throw new Exception("Null content identifier; content must be written before retrieving id");
		}
		return $this->getSourceIdentifier() . ContentService::SEPARATOR . $this->id;
	}
831458
public function write() {
        $filename = $this->getFileName();
        if(basename($filename) == '.php') {
            throw new CatchableException('Invalid Filename: '.$filename);
        }
        if(!is_dir(dirname($filename))) {
            mkdir(dirname($filename), 0777, true);
        }
        file_put_contents($filename, $this->toString());
    }
498121
public function sendContent()
	{
		if (! $this->isSuccessful()) {
			return parent::sendContent();
		}
		
		if (0 === $this->maxlen) {
			return $this;
		}
		
		$out = fopen('php://output', 'wb');
		$in = $this->resource->getStream();
		
		stream_copy_to_stream($in, $out, $this->maxlen, $this->offset);
		
		fclose($out);
		fclose($in);
		
		return $this;
	}
792159
private function getOutputWriter()
    {
        if ($this->useFile) {
            $of = $this->getOutfile();
            if (!$of) {
                $of = new PhingFile($this->formatter->getPreferredOutfile());
            }

            return new FileWriter($of, $this->append);
        } else {
            return $this->getDefaultOutput();
        }
    }