mirror of
https://github.com/andres-montanez/Magallanes
synced 2024-05-04 23:13:16 +02:00
Improve logging
This commit is contained in:
parent
46684ea649
commit
2582479281
|
@ -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)
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue