1
0

Errorlog.php 779 B

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
  6. * SPDX-FileCopyrightText: 2014 Christian Kampka <christian@kampka.net>
  7. * SPDX-License-Identifier: MIT
  8. */
  9. namespace OC\Log;
  10. use OC\SystemConfig;
  11. use OCP\Log\IWriter;
  12. class Errorlog extends LogDetails implements IWriter {
  13. public function __construct(
  14. SystemConfig $config,
  15. protected string $tag = 'nextcloud',
  16. ) {
  17. parent::__construct($config);
  18. }
  19. /**
  20. * Write a message in the log
  21. *
  22. * @param string|array $message
  23. */
  24. public function write(string $app, $message, int $level): void {
  25. error_log('[' . $this->tag . ']['.$app.']['.$level.'] '.$this->logDetailsAsJSON($app, $message, $level));
  26. }
  27. }