original_string: protected function write($level, $msg)
      {
          $time = date('Y-m-d H:i:s', time());
          $msg = "[" . $time . "][" . static::getLevelName($level) . "] " . $msg . PHP_EOL;
  
          if($this->debugOutput === true){
              echo $msg;
          }
          if (static::$silent) {
              return false;
          }
          if (!$this->isAllowed($level)) {
              return false;
          }
          $fh = fopen($this->logFile, 'a');
          if (!fwrite($fh, $msg)) {
              throw new \Exception('Failed to write to log file at ' . $this->logFile);
          }
  
          return true;
      }
code: protected function write($level, $msg)
      {
          $time = date('Y-m-d H:i:s', time());
          $msg = "[" . $time . "][" . static::getLevelName($level) . "] " . $msg . PHP_EOL;
  
          if($this->debugOutput === true){
              echo $msg;
          }
          if (static::$silent) {
              return false;
          }
          if (!$this->isAllowed($level)) {
              return false;
          }
          $fh = fopen($this->logFile, 'a');
          if (!fwrite($fh, $msg)) {
              throw new \Exception('Failed to write to log file at ' . $this->logFile);
          }
  
          return true;
      }
code_tokens: protected function write ( $ level , $ msg ) { $ time = date ( 'Y-m-d H:i:s' , time ( ) ) ; $ msg = "[" . $ time . "][" . static :: getLevelName ( $ level ) . "] " . $ msg . PHP_EOL ; if ( $ this -> debugOutput === true ) { echo $ msg ; } if ( static :: $ silent ) { return false ; } if ( ! $ this -> isAllowed ( $ level ) ) { return false ; } $ fh = fopen ( $ this -> logFile , 'a' ) ; if ( ! fwrite ( $ fh , $ msg ) ) { throw new \ Exception ( 'Failed to write to log file at ' . $ this -> logFile ) ; } return true ; }
docstring: Writes to log file.
  
  @param int    $level
  @param string $msg
  
  @return bool
  @throws \Exception
docstring_tokens: Writes to log file .