diff --git a/src/channel/PhutilLogFileChannel.php b/src/channel/PhutilLogFileChannel.php index 6607751..ecc9cc1 100644 --- a/src/channel/PhutilLogFileChannel.php +++ b/src/channel/PhutilLogFileChannel.php @@ -1,34 +1,41 @@ logfile = fopen($path, 'a'); $this->log('--- '.getmypid().' ---'); return $this; } public function read() { $buffer = parent::read(); - $this->log('>>> '.phutil_loggable_string($buffer)); + + if (strlen($buffer)) { + $this->log('>>> '.phutil_loggable_string($buffer)); + } + return $buffer; } public function write($message) { - $this->log('<<< '.phutil_loggable_string($message)); + if (strlen($message)) { + $this->log('<<< '.phutil_loggable_string($message)); + } + return parent::write($message); } private function log($message) { if ($this->logfile) { fwrite($this->logfile, $message."\n"); } } }