-
Is there a way to log the output of the Git commands? I didn't find any function right away that expected a LoggerInterface as a parameter, for example. I noticed that the outputs from StdOut and StdErr are captured in the RunnerResult object. That would actually be exactly what I need. |
Beta Was this translation helpful? Give feedback.
Answered by janpecha Jul 2, 2022
Replies: 1 comment
-
Hello. You can create own implementation of IRunner, something like: class LoggingRunner implements \CzProject\GitPhp\IRunner { private $logger; private $runner; public function __construct( LoggerInterface $logger, \CzProject\GitPhp\IRunner $runner ) { $this->logger = $logger; $this->runner = $runner; } public function run($cwd, array $args, array $env = NULL) { $result = $this->runner->run($cwd, $args, $env); // log result $this->logger->log($result); return $result; } public function getCwd() { return $this->runner->getCwd(); } } $git = new \CzProject\GitPhp\Git( new LoggingRunner( $logger, new \CzProject\GitPhp\Runners\CliRunner ) ); $repo = $git->open('/path/to/repo'); |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by janpecha
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Hello. You can create own implementation of IRunner, something like: