<commit_before># <?php
call_user_func( function() {
	global $wgMWLoggerDefaultSpi, $wgDebugLogFile, $wgDebugLogGroups;

	$wgMWLoggerDefaultSpi = array(
		'class' => '\\MediaWiki\\Logger\\MonologSpi',
		'args' => array( array(
			'loggers' => array(
				'@default' => array(
					'processors' => array( 'wiki', 'psr', 'pid', 'uid', 'web' ),
					'handlers' => array( 'default' ),
				),
				'runJobs' => array(
					'processors' => array( 'wiki', 'psr', 'pid' ),
					'handlers' => array( 'default' ),
				),
				'profileoutput' => array(
					'handlers' => array( 'profiler' ),
					'processors' => array( 'psr' ),
				),
				'error-json' => array(
					'handlers' => array( 'blackhole' ),
				),
				'exception-json' => array(
					'handlers' => array( 'blackhole' ),
				),
				'fatal-json' => array(
					'handlers' => array( 'blackhole' ),
				),
			),
			'processors' => array(
				'wiki' => array(
					'class' => '\\MediaWiki\\Logger\\Monolog\\WikiProcessor',
				),
				'psr' => array(
					'class' => '\\Monolog\\Processor\\PsrLogMessageProcessor',
				),
				'pid' => array(
					'class' => '\\Monolog\\Processor\\ProcessIdProcessor',
				),
				'uid' => array(
					'class' => '\\Monolog\\Processor\\UidProcessor',
				),
				'web' => array(
					'class' => '\\Monolog\\Processor\\WebProcessor',
				),
			),
			'handlers' => array(
				'default' => array(
					'class' => '\\Monolog\\Handler\\StreamHandler',
					'args' => array( $wgDebugLogFile ?: '/vagrant/logs/mediawiki-' . wfWikiID() . '-debug.log' ),
					'formatter' => 'line',
				),
				'blackhole' => array(
					'class' => '\\Monolog\\Handler\\NullHandler',
				),
				'profiler' => array(
					'class' => '\\Monolog\\Handler\\StreamHandler',
					'args' => array( '/vagrant/logs/mediawiki-' . wfWikiID() . '-profiler.log' ),
					'formatter' => 'profiler',
				),
			),
			'formatters' => array(
				'line' => array(
					'class' => '\\MediaWiki\\Logger\\Monolog\\LineFormatter',
					'args' => array(
						"%datetime% %extra.wiki% %channel% %level_name%: %message% %context% %exception%\n",
						'Y-m-d H:i:s',
						true, // allowInlineLineBreaks
						true, // ignoreEmptyContextAndExtra
						true, // includeStacktraces
					),
				),
				'profiler' => array(
					'class' => '\\Monolog\\Formatter\\LineFormatter',
					'args' => array( "%datetime% %message%\n\n", null, true, true ),
				),
			),
		) ),
	);

	foreach ( $wgDebugLogGroups as $group => $target ) {
		if ( is_array( $target ) ) {
			// advanced settings like sample rate are ignored
			$target = $target['destination'];
		}
		if ( !$target ) {
			$wgMWLoggerDefaultSpi['args'][0]['loggers'][$group] = array( 'blackhole' );
			continue;
		}
		$wgMWLoggerDefaultSpi['args'][0]['loggers'][$group] = array(
			'processors' => array( 'wiki', 'psr', 'pid', 'uid', 'web' ),
			'handlers' => array( $group ),
		);
		$wgMWLoggerDefaultSpi['args'][0]['handlers'][$group] = array(
			'class' => '\\Monolog\\Handler\\StreamHandler',
			'args' => array( $target ),
			'formatter' => 'line',
		);
	}

} );<commit_msg>Fix $wgDebugLogGroup handling in psr3 role<commit_after># <?php
call_user_func( function() {
	global $wgMWLoggerDefaultSpi, $wgDebugLogFile, $wgDebugLogGroups;

	$wgMWLoggerDefaultSpi = array(
		'class' => '\\MediaWiki\\Logger\\MonologSpi',
		'factory' => function ( ...$args ) {
			global $wgDebugLogFile, $wgDebugLogGroups;

			foreach ( $wgDebugLogGroups as $group => $target ) {
				$level = null;
				if ( is_array( $target ) ) {
					// some advanced settings like sample rate are ignored
					$level = $target['level'] ?? null;
					$target = $target['destination'] ?? null;
					if ( !$target ) {
						throw new Exception( '$wgDebugLogGroups: destination field is required' );
					}
				}
				if ( !$target ) {
					$args[0]['loggers'][$group] = array( 'blackhole' );
					continue;
				}
				$args[0]['loggers'][$group] = array(
					'processors' => array( 'wiki', 'psr', 'pid', 'uid', 'web' ),
					'handlers' => array( $group ),
				);
				$args[0]['handlers'][$group] = array(
					'class' => '\\Monolog\\Handler\\StreamHandler',
					'args' => array_filter( array( $target, $level ) ),
					'formatter' => 'line',
				);
			}

			return new \MediaWiki\Logger\MonologSpi( ...$args );
		},
		'args' => array( array(
			'loggers' => array(
				'@default' => array(
					'processors' => array( 'wiki', 'psr', 'pid', 'uid', 'web' ),
					'handlers' => array( 'default' ),
				),
				'runJobs' => array(
					'processors' => array( 'wiki', 'psr', 'pid' ),
					'handlers' => array( 'default' ),
				),
				'profileoutput' => array(
					'handlers' => array( 'profiler' ),
					'processors' => array( 'psr' ),
				),
				'error-json' => array(
					'handlers' => array( 'blackhole' ),
				),
				'exception-json' => array(
					'handlers' => array( 'blackhole' ),
				),
				'fatal-json' => array(
					'handlers' => array( 'blackhole' ),
				),
			),
			'processors' => array(
				'wiki' => array(
					'class' => '\\MediaWiki\\Logger\\Monolog\\WikiProcessor',
				),
				'psr' => array(
					'class' => '\\Monolog\\Processor\\PsrLogMessageProcessor',
				),
				'pid' => array(
					'class' => '\\Monolog\\Processor\\ProcessIdProcessor',
				),
				'uid' => array(
					'class' => '\\Monolog\\Processor\\UidProcessor',
				),
				'web' => array(
					'class' => '\\Monolog\\Processor\\WebProcessor',
				),
			),
			'handlers' => array(
				'default' => array(
					'class' => '\\Monolog\\Handler\\StreamHandler',
					'args' => array( $wgDebugLogFile ?: '/vagrant/logs/mediawiki-' . wfWikiID() . '-debug.log' ),
					'formatter' => 'line',
				),
				'blackhole' => array(
					'class' => '\\Monolog\\Handler\\NullHandler',
				),
				'profiler' => array(
					'class' => '\\Monolog\\Handler\\StreamHandler',
					'args' => array( '/vagrant/logs/mediawiki-' . wfWikiID() . '-profiler.log' ),
					'formatter' => 'profiler',
				),
			),
			'formatters' => array(
				'line' => array(
					'class' => '\\MediaWiki\\Logger\\Monolog\\LineFormatter',
					'args' => array(
						"%datetime% %extra.wiki% %channel% %level_name%: %message% %context% %exception%\n",
						'Y-m-d H:i:s',
						true, // allowInlineLineBreaks
						true, // ignoreEmptyContextAndExtra
						true, // includeStacktraces
					),
				),
				'profiler' => array(
					'class' => '\\Monolog\\Formatter\\LineFormatter',
					'args' => array( "%datetime% %message%\n\n", null, true, true ),
				),
			),
		) ),
	);

} );
{'fraction_non_alphanumeric': 0.22111955341913475, 'fraction_numerical': 0.0010854396030392309, 'mean_word_length': 2.75, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 110, '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': '7243955', 'n_tokens_mistral': 2905, 'n_tokens_neox': 2272, 'n_words': 416}