SimpleOutput.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <?php
  2. /**
  3. * SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors
  4. * SPDX-FileCopyrightText: 2015 ownCloud GmbH
  5. * SPDX-License-Identifier: AGPL-3.0-only
  6. */
  7. namespace OC\Migration;
  8. use OCP\Migration\IOutput;
  9. use Psr\Log\LoggerInterface;
  10. /**
  11. * Class SimpleOutput
  12. *
  13. * Just a simple IOutput implementation with writes messages to the log file.
  14. * Alternative implementations will write to the console or to the web ui (web update case)
  15. *
  16. * @package OC\Migration
  17. */
  18. class SimpleOutput implements IOutput {
  19. public function __construct(
  20. private LoggerInterface $logger,
  21. private $appName,
  22. ) {
  23. }
  24. public function debug(string $message): void {
  25. $this->logger->debug($message, ['app' => $this->appName]);
  26. }
  27. /**
  28. * @param string $message
  29. * @since 9.1.0
  30. */
  31. public function info($message): void {
  32. $this->logger->info($message, ['app' => $this->appName]);
  33. }
  34. /**
  35. * @param string $message
  36. * @since 9.1.0
  37. */
  38. public function warning($message): void {
  39. $this->logger->warning($message, ['app' => $this->appName]);
  40. }
  41. /**
  42. * @param int $max
  43. * @since 9.1.0
  44. */
  45. public function startProgress($max = 0): void {
  46. }
  47. /**
  48. * @param int $step
  49. * @param string $description
  50. * @since 9.1.0
  51. */
  52. public function advance($step = 1, $description = ''): void {
  53. }
  54. /**
  55. * @since 9.1.0
  56. */
  57. public function finishProgress(): void {
  58. }
  59. }