Jyxo\Rpc\Server::enableLogging PHP Method

enableLogging() public method

Turns on logging.
public enableLogging ( string $filename, callable $callback = null ) : self
$filename string Log file path.
$callback callable Function to be called prior to logging a message.
return self
    public function enableLogging(string $filename, callable $callback = null) : self
    {
        $filename = trim($filename);
        // A log file has to be provided
        if (empty($filename)) {
            throw new \InvalidArgumentException('No log file was provided.');
        }
        $this->logFile = $filename;
        $this->logCallback = $callback;
        return $this;
    }

Usage Example

Beispiel #1
0
 /**
  * Tests registering a not callable function.
  */
 public function testInvalidLogCallback()
 {
     $this->setExpectedException('\\InvalidArgumentException');
     $this->rpc->enableLogging('file.log', 'dummy');
 }
All Usage Examples Of Jyxo\Rpc\Server::enableLogging