<commit_before><?php
/*
 * Copyright (c) 2014, <NAME>
 * All rights reserved.
 *
 * This file is part of Conductor. For the full copyright and license information
 * please view the LICENSE file that was distributed with this source code.
 */
namespace zpt\cdt\bin;

use \Psr\Log\LogLevel;
use \Psr\Log\AbstractLogger;
use \Psr\Log\LoggerInterface;

/**
 * PSR-3 LoggerInterface implementation that outputs to the command line.
 *
 * @author <NAME> <<EMAIL>>
 */
class CmdlnLogger extends AbstractLogger implements LoggerInterface
{

	const GREEN = 32;
	const RED = 31;
	const YELLOW = 93;
	const WHITE = 39;

	private $showDebug = false;

	public function log($level, $message, array $context = []) {
		switch ($level) {
			case LogLevel::EMERGENCY:
			case LogLevel::ALERT:
			case LogLevel::CRITICAL:
			case LogLevel::ERROR:
			$this->printError(String($message)->format($context));
			break;

			case LogLevel::WARNING:
			$this->printWarning(String($message)->format($context));
			break;

			case LogLevel::NOTICE:
			$this->printSuccess(String($message)->format($context));
			break;

			case LogLevel::INFO:
			$this->printInfo(String($message)->format($context));
			break;

			case LogLevel::DEBUG:
			if ($this->showDebug) {
				if (is_array($msg)) {
					$msg = implode(' ', $msg);
				}
				$msg = String($msg)->format($context);
				echo "$msg\n";
			}
			break;

			default:
			assert("/* Invalid log level $level */ false;");
		}
	}

	public function setShowDebug($showDebug) {
		$this->showDebug = (bool) $showDebug;
	}

	private function printError($msg) {
		$this->printLog($msg, '✖', self::RED);
	}

	private function printInfo($msg) {
		$this->printLog($msg, '➜', self::WHITE);
	}

	private function printSuccess($msg) {
		$this->printLog($msg, '✔', self::GREEN);<commit_msg>Fix debug output for CmdLnLogger<commit_after><?php
/*
 * Copyright (c) 2014, <NAME>
 * All rights reserved.
 *
 * This file is part of Conductor. For the full copyright and license information
 * please view the LICENSE file that was distributed with this source code.
 */
namespace zpt\cdt\bin;

use \Psr\Log\LogLevel;
use \Psr\Log\AbstractLogger;
use \Psr\Log\LoggerInterface;

/**
 * PSR-3 LoggerInterface implementation that outputs to the command line.
 *
 * @author <NAME> <<EMAIL>>
 */
class CmdlnLogger extends AbstractLogger implements LoggerInterface
{

	const GREEN = 32;
	const RED = 31;
	const YELLOW = 93;
	const WHITE = 39;

	private $showDebug = false;

	public function log($level, $message, array $context = []) {
		switch ($level) {
			case LogLevel::EMERGENCY:
			case LogLevel::ALERT:
			case LogLevel::CRITICAL:
			case LogLevel::ERROR:
			$this->printError(String($message)->format($context));
			break;

			case LogLevel::WARNING:
			$this->printWarning(String($message)->format($context));
			break;

			case LogLevel::NOTICE:
			$this->printSuccess(String($message)->format($context));
			break;

			case LogLevel::INFO:
			$this->printInfo(String($message)->format($context));
			break;

			case LogLevel::DEBUG:
			if ($this->showDebug) {
				if (is_array($message)) {
					$message = implode(' ', $message);
				}
				$message = String($message)->format($context);
				echo "$message\n";
			}
			break;

			default:
			assert("/* Invalid log level $level */ false;");
		}
	}

	public function setShowDebug($showDebug) {
		$this->showDebug = (bool) $showDebug;
	}

	private function printError($msg) {
		$this->printLog($msg, '✖', self::RED);
	}

	private function printInfo($msg) {
		$this->printLog($msg, '➜', self::WHITE);
	}

	private function printSuccess($msg) {
		$this->printLog($msg, '✔', self::GREEN);
{'fraction_non_alphanumeric': 0.15837228485015123, 'fraction_numerical': 0.0071487489689304375, 'mean_word_length': 4.031811894882434, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 39, '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': '1646063', 'n_tokens_mistral': 1357, 'n_tokens_neox': 1182, 'n_words': 301}