Improve logging

This commit is contained in:
thePanz 2017-05-08 19:35:29 +02:00
parent 46684ea649
commit 2582479281

View file

@ -407,7 +407,9 @@ class Runtime
$process = new Process($cmd);
$process->setTimeout($timeout);
$process->run();
$process->run(function($type, $buffer) {
$this->runLocalCommandCallback($type, $buffer);
});
$this->log($process->getOutput(), LogLevel::DEBUG);
if (!$process->isSuccessful()) {
@ -417,6 +419,21 @@ class Runtime
return $process;
}
/**
* Log the output produced by the Process execution
*
* @param string $type
* @param string $buffer
*/
protected function runLocalCommandCallback($type, $buffer)
{
if (Process::OUT === $type) {
$this->log($buffer, LogLevel::DEBUG);
} else {
$this->log($buffer, LogLevel::ERROR);
}
}
/**
* Executes a command remotely, if jail is true, it will run inside the Host Path and the Release (if available)
*