<commit_before><?php
namespace Kir\Logging\Essentials\Filters;

use Kir\Logging\Essentials\Common\AbstractLoggerAware;
use Psr\Log\LoggerInterface;

class MessagePrefixProxy extends AbstractLoggerAware {
	/**
	 * @var string
	 */
	private $caption = null;

	/**
	 * @var string
	 */
	private $concatenator = null;

	/**
	 * @var string
	 */
	private $endingConcatenator = null;

	/**
	 * @param LoggerInterface $logger
	 * @param string $caption
	 * @param string $concatenator
	 * @param string $endingConcatenator
	 */
	public function __construct(LoggerInterface $logger, $caption = null, $concatenator = ' > ', $endingConcatenator = ': ') {
		parent::__construct($logger);
		$this->caption = $caption;
		$this->concatenator = $concatenator;
		$this->endingConcatenator = $endingConcatenator;
	}

	/**
	 * Logs with an arbitrary level.
	 * @param mixed $level
	 * @param string $message
	 * @param array $context
	 * @return $this
	 */
	public function log($level, $message, array $context = array()) {
		$parts = array();
		$parts[] = join($this->concatenator, $this->caption);
		$parts[] = $message;
		$parts = array_filter($parts);
		$newMessage = join($this->endingConcatenator, $parts);
		$this->logger()->log($level, $newMessage, $context);
		return $this;
	}
}<commit_msg>Fixed non-array-captions in MessagePrefixProxy<commit_after><?php
namespace Kir\Logging\Essentials\Filters;

use Kir\Logging\Essentials\Common\AbstractLoggerAware;
use Psr\Log\LoggerInterface;

class MessagePrefixProxy extends AbstractLoggerAware {
	/**
	 * @var string
	 */
	private $caption = null;

	/**
	 * @var string
	 */
	private $concatenator = null;

	/**
	 * @var string
	 */
	private $endingConcatenator = null;

	/**
	 * @param LoggerInterface $logger
	 * @param string $caption
	 * @param string $concatenator
	 * @param string $endingConcatenator
	 */
	public function __construct(LoggerInterface $logger, $caption = null, $concatenator = ' > ', $endingConcatenator = ': ') {
		parent::__construct($logger);
		$this->caption = $caption;
		$this->concatenator = $concatenator;
		$this->endingConcatenator = $endingConcatenator;
	}

	/**
	 * Logs with an arbitrary level.
	 * @param mixed $level
	 * @param string $message
	 * @param array $context
	 * @return $this
	 */
	public function log($level, $message, array $context = array()) {
		$parts = array();
		if(is_array($this->caption)) {
			$parts[] = join($this->concatenator, $this->caption);
		} else {
			$parts[] = $this->caption;
		}
		$parts[] = $message;
		$parts = array_filter($parts);
		$newMessage = join($this->endingConcatenator, $parts);
		$this->logger()->log($level, $newMessage, $context);
		return $this;
	}
}
{'fraction_non_alphanumeric': 0.15657698056801195, 'fraction_numerical': 0.0, 'mean_word_length': 4.238747553816047, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7467667', 'n_tokens_mistral': 926, 'n_tokens_neox': 851, 'n_words': 193}