<commit_before><?php
use Monolog\Formatter\LineFormatter;
use Monolog\Handler\FilterHandler;
use Monolog\Handler\StreamHandler;
use Monolog\Logger as MonoLogger;

class Logger
{
	const DEBUG = MonoLogger::DEBUG;
	const INFO = MonoLogger::INFO;
	const NOTICE = MonoLogger::NOTICE;
	const WARNING = MonoLogger::WARNING;
	const ERROR = MonoLogger::ERROR;
	const CRITICAL = MonoLogger::CRITICAL;
	const ALERT = MonoLogger::ALERT;
	const EMERGENCY = MonoLogger::EMERGENCY;
	
	public static function make($name)
	{
		return new MonoLogger($name);
	}
	
	/**
	 * @param int $logLevel : one of the Logger constants
	 * @param string[] $messages : the messages to log
	 */
	public static function log(int $logLevel, string ...$messages)
	{
		self::getDefaultLogger()->log($logLevel, implode(PHP_EOL, $messages));
	}
	
	private static function getDefaultLogger()
	{
		static $appLogger = null;
		
		if (is_null($appLogger))
		{
			$appLogger = new MonoLogger(Config::get('app.name'));
			$formatter = new LineFormatter("[%datetime%] %message%\n", null, true); // allow newlines
			
			foreach ($appLogger->getLevels() as $name => $level)
			{
				$mainHandler = new StreamHandler(LOG_DIR . '/' . strtolower($name) . '.log', $level, true, 0664);
				
				$mainHandler->setFormatter($formatter);
				$appLogger->pushHandler(new FilterHandler($mainHandler, $level, $level));
			}
		}
		<commit_msg>Getting rid of variadics in Logger::log(). HHVM doesn't support it and most people won't use it anyway.<commit_after><?php
use Monolog\Formatter\LineFormatter;
use Monolog\Handler\FilterHandler;
use Monolog\Handler\StreamHandler;
use Monolog\Logger as MonoLogger;

class Logger
{
	const DEBUG = MonoLogger::DEBUG;
	const INFO = MonoLogger::INFO;
	const NOTICE = MonoLogger::NOTICE;
	const WARNING = MonoLogger::WARNING;
	const ERROR = MonoLogger::ERROR;
	const CRITICAL = MonoLogger::CRITICAL;
	const ALERT = MonoLogger::ALERT;
	const EMERGENCY = MonoLogger::EMERGENCY;
	
	public static function make($name)
	{
		return new MonoLogger($name);
	}
	
	/**
	 * @param int $logLevel : one of the Logger constants
	 * @param string $message : the message to log
	 */
	public static function log(int $logLevel, string $message)
	{
		self::getDefaultLogger()->log($logLevel, $message);
	}
	
	private static function getDefaultLogger()
	{
		static $appLogger = null;
		
		if (is_null($appLogger))
		{
			$appLogger = new MonoLogger(Config::get('app.name'));
			$formatter = new LineFormatter("[%datetime%] %message%\n", null, true); // allow newlines
			
			foreach ($appLogger->getLevels() as $name => $level)
			{
				$mainHandler = new StreamHandler(LOG_DIR . '/' . strtolower($name) . '.log', $level, true, 0664);
				
				$mainHandler->setFormatter($formatter);
				$appLogger->pushHandler(new FilterHandler($mainHandler, $level, $level));
			}
		}
		
{'fraction_non_alphanumeric': 0.1377605086541858, 'fraction_numerical': 0.00282585658777817, 'mean_word_length': 4.52046783625731, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, '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': '470329', 'n_tokens_mistral': 981, 'n_tokens_neox': 881, 'n_words': 229}