mirror of
https://github.com/nextcloud/server.git
synced 2026-11-26 16:15:53 +01:00
ILogFactory::getCustomPsrLogger() gets an optional $structuredContext flag. When set, array values of the log context are written as nested data in the log entry instead of being encoded to a JSON string, so consumers can read them as fields. Values used as message placeholders are still converted to strings, and loggers without the flag, including nextcloud.log, are unchanged. Message interpolation now only replaces placeholders that occur in the message, so array values that are not placeholders are never cast to strings. Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: Ghassen kefi <ghassen.kefi.dev@gmail.com>
38 lines
1.1 KiB
PHP
38 lines
1.1 KiB
PHP
<?php
|
|
|
|
/**
|
|
* SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
|
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
|
*/
|
|
|
|
namespace OCP\Log;
|
|
|
|
use Psr\Log\LoggerInterface;
|
|
|
|
/**
|
|
* Interface ILogFactory
|
|
*
|
|
* @since 14.0.0
|
|
*/
|
|
interface ILogFactory {
|
|
/**
|
|
* @param string $type - one of: file, errorlog, syslog, systemd
|
|
* @return IWriter
|
|
* @since 14.0.0
|
|
*/
|
|
public function get(string $type): IWriter;
|
|
|
|
/**
|
|
* @param string $path
|
|
* @param string $type
|
|
* @param string $tag
|
|
* @param bool $structuredContext Keep array values of the context as structured data in the log entry
|
|
* instead of encoding them to a JSON string. Values used as message
|
|
* placeholders are always converted to strings.
|
|
* @return LoggerInterface
|
|
* @since 22.0.0 - Parameters $type and $tag were added in 24.0.0
|
|
* @since 36.0.0 - Parameter $structuredContext was added
|
|
*/
|
|
public function getCustomPsrLogger(string $path, string $type = 'file', string $tag = 'Nextcloud', bool $structuredContext = false): LoggerInterface;
|
|
}
|