1
0

SimpleOutput.php 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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. private LoggerInterface $logger;
  35. private $appName;
  36. public function __construct(LoggerInterface $logger, $appName) {
  37. $this->logger = $logger;
  38. $this->appName = $appName;
  39. }
  40. public function debug(string $message): void {
  41. $this->logger->debug($message, ['app' => $this->appName]);
  42. }
  43. /**
  44. * @param string $message
  45. * @since 9.1.0
  46. */
  47. public function info($message) {
  48. $this->logger->info($message, ['app' => $this->appName]);
  49. }
  50. /**
  51. * @param string $message
  52. * @since 9.1.0
  53. */
  54. public function warning($message) {
  55. $this->logger->warning($message, ['app' => $this->appName]);
  56. }
  57. /**
  58. * @param int $max
  59. * @since 9.1.0
  60. */
  61. public function startProgress($max = 0) {
  62. }
  63. /**
  64. * @param int $step
  65. * @param string $description
  66. * @since 9.1.0
  67. */
  68. public function advance($step = 1, $description = '') {
  69. }
  70. /**
  71. * @since 9.1.0
  72. */
  73. public function finishProgress() {
  74. }
  75. }