SimpleOutput.php 1.9 KB

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