<commit_before><?php
namespace Atlas\Cli;

use Psr\Log\LoggerInterface;
use Psr\Log\LogLevel;
use Aura\Cli\Stdio\Handle;

/**
 *
 * A basic logger implementation that writes to a resource handle.
 *
 */
class Logger implements LoggerInterface
{
    /**
     *
     * The resource handle.
     *
     * @var Handle
     *
     */
    protected $handle;

    /**
     *
     * Constructor.
     *
     * @param Handle $handle The resource handle to write to.
     *
     */
    public function __construct(Handle $handle)
    {
        $this->handle = $handle;
    }

    /**
     *
     * System is unusable.
     *
     * @param string $message
     *
     * @param array $context
     *
     * @return null
     *
     */
    public function emergency($message, array $context = [])
    {
        $this->log(LogLevel::EMERGENCY, $message, $context);
    }

    /**
     *
     * Action must be taken immediately.
     *
     * @param string $message
     *
     * @param array $context
     *
     * @return null
     *
     */
    public function alert($message, array $context = [])
    {
        $this->log(LogLevel::ALERT, $message, $context);
    }

    /**
     *
     * Critical conditions.
     *
     * @param string $message
     *
     * @param array $context
     *
     * @return null
     *
     */
    public function critical($message, array $context = [])
    {
        $this->log(LogLevel::CRITICAL, $message, $context);
    }

    /**
     *
     * Runtime errors that do not require immediate action but should typically
     * be logged and monitored.
     *
     * @param string $message
     *
     * @param array $context
     *
     * @return null
     *
     */
    public function error($message, array $context = [])
    {
        $this->log(LogLevel::ERROR, $message, $context);
    }

    /**
     *
     * Exceptional occurrences that are not errors.
     *
     * @param string $message
     *
     * @param array $context
     *
     * @return null
     *
     */
    public function warning($message, array $context = [])
    {
        $this->log(LogLevel::WARNING, $message, $context);
    }

    /**
     *
     * Normal but significant events.
     *
     * @param string $message
     *
     * @param array $context
     *
     * @return null
     *
     */
    public function notice($message, array $context = [])
    {
        $this->log(LogLevel::NOTICE, $message, $context);
    }

    /**
     *
     * Interesting events.
     *
     * @param string $message
     *
     * @param array $context
     *
     * @return null
     *
     */
    public function info($message, array $context = [])
    {
        $this->log(LogLevel::INFO, $message, $context);
    }

    /**
     *
     * Detailed debug information.
     *
     * @param string $message
     *
     * @param array $context
     *
     * @return null
     *
     */
    public function debug($message, array $context = [])
    {
        $this->log(LogLevel::DEBUG, $message, $context);
    }

    /**
     *
     * Logs with an arbitrary level.
     *
     * @param mixed $level
     *
     * @param string $message
     *
     * @param array $context
     *
     * @return null
     *
     */
    public function log($level, $message, array $context = [])
    {
        $replace = [];<commit_msg>extend from AbstractLogger instead of writing all methods<commit_after><?php
/**
 *
 * This file is part of Atlas for PHP.
 *
 * @license http://opensource.org/licenses/MIT MIT
 *
 */
namespace Atlas\Cli;

use Psr\Log\AbstractLogger;
use Psr\Log\LogLevel;
use Aura\Cli\Stdio\Handle;

/**
 *
 * A basic logger implementation that writes to a resource handle.
 *
 */
class Logger extends AbstractLogger
{
    /**
     *
     * The resource handle.
     *
     * @var Handle
     *
     */
    protected $handle;

    /**
     *
     * Constructor.
     *
     * @param Handle $handle The resource handle to write to.
     *
     */
    public function __construct(Handle $handle)
    {
        $this->handle = $handle;
    }

    /**
     *
     * Logs with an arbitrary level.
     *
     * @param mixed $level
     *
     * @param string $message
     *
     * @param array $context
     *
     * @return null
     *
     */
    public function log($level, $message, array $context = [])
    {
        $replace = [];
{'fraction_non_alphanumeric': 0.13125, 'fraction_numerical': 0.0, 'mean_word_length': 1.7210327455919396, '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': '7341025', 'n_tokens_mistral': 1333, 'n_tokens_neox': 1310, 'n_words': 324}