1
0

SimpleOutput.php 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2017, ownCloud GmbH
  4. *
  5. * @author Joas Schilling <coding@schilljs.com>
  6. *
  7. * @license AGPL-3.0
  8. *
  9. * This code is free software: you can redistribute it and/or modify
  10. * it under the terms of the GNU Affero General Public License, version 3,
  11. * as published by the Free Software Foundation.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU Affero General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU Affero General Public License, version 3,
  19. * along with this program. If not, see <http://www.gnu.org/licenses/>
  20. *
  21. */
  22. namespace OC\Migration;
  23. use OCP\Migration\IOutput;
  24. use Psr\Log\LoggerInterface;
  25. /**
  26. * Class SimpleOutput
  27. *
  28. * Just a simple IOutput implementation with writes messages to the log file.
  29. * Alternative implementations will write to the console or to the web ui (web update case)
  30. *
  31. * @package OC\Migration
  32. */
  33. class SimpleOutput implements IOutput {
  34. public function __construct(
  35. private LoggerInterface $logger,
  36. private $appName,
  37. ) {
  38. }
  39. public function debug(string $message): void {
  40. $this->logger->debug($message, ['app' => $this->appName]);
  41. }
  42. /**
  43. * @param string $message
  44. * @since 9.1.0
  45. */
  46. public function info($message): void {
  47. $this->logger->info($message, ['app' => $this->appName]);
  48. }
  49. /**
  50. * @param string $message
  51. * @since 9.1.0
  52. */
  53. public function warning($message): void {
  54. $this->logger->warning($message, ['app' => $this->appName]);
  55. }
  56. /**
  57. * @param int $max
  58. * @since 9.1.0
  59. */
  60. public function startProgress($max = 0): void {
  61. }
  62. /**
  63. * @param int $step
  64. * @param string $description
  65. * @since 9.1.0
  66. */
  67. public function advance($step = 1, $description = ''): void {
  68. }
  69. /**
  70. * @since 9.1.0
  71. */
  72. public function finishProgress(): void {
  73. }
  74. }