nextcloud/lib/private/Log/Errorlog.php

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

32 lines
789 B
PHP
Raw Permalink Normal View History

2014-11-19 14:10:48 -05:00
<?php
declare(strict_types=1);
2014-11-19 14:10:48 -05:00
/**
* SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
* SPDX-FileCopyrightText: 2014 Christian Kampka <christian@kampka.net>
* SPDX-License-Identifier: MIT
2014-11-19 14:10:48 -05:00
*/
2016-05-02 08:04:58 -04:00
namespace OC\Log;
use OC\SystemConfig;
use OCP\Log\IWriter;
class Errorlog extends LogDetails implements IWriter {
public function __construct(
SystemConfig $config,
protected string $tag = 'nextcloud',
) {
parent::__construct($config);
}
2014-11-19 14:10:48 -05:00
/**
* Write a message in the log
*
* @param string|array $message
2014-11-19 14:10:48 -05:00
*/
public function write(string $app, $message, int $level): void {
error_log('[' . $this->tag . '][' . $app . '][' . $level . '] ' . $this->logDetailsAsJSON($app, $message, $level));
2014-11-19 14:10:48 -05:00
}
}