<commit_before><?php


namespace LaravelExtendedErrors;

use Monolog\Logger as Monolog;

class Logger extends Monolog {

    public function addRecord($level, $message, array $context = array()) {
        if ($message instanceof \Exception) {
            $context['title'] = $message->getMessage();
            $handler = new ExceptionHandler($this);
            $message = $handler->renderExceptionForLogger($message);
        } else {
            $context['title'] = $message;
        }
        return parent::addRecord($level, $message, $context);
    }

}<commit_msg>Improved Logger to detect exceptions in context (Laravel 5.5 compability)<commit_after><?php


namespace LaravelExtendedErrors;

use Monolog\Logger as Monolog;

class Logger extends Monolog {

    public function addRecord($level, $message, array $context = array()) {
        if ($message instanceof \Exception || array_get($context, 'exception', null) instanceof \Exception) {
            /** @var \Exception $exception */
            $exception = $message instanceof \Exception ? $message : $context['exception'];
            $context['title'] = $exception->getMessage();
            $handler = new ExceptionHandler($this);
            $message = $handler->renderExceptionForLogger($exception);
        } else {
            $context['title'] = $message;
        }
        return parent::addRecord($level, $message, $context);
    }

}
{'fraction_non_alphanumeric': 0.13068181818181818, 'fraction_numerical': 0.0014204545454545455, 'mean_word_length': 3.002840909090909, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '5612205', 'n_tokens_mistral': 360, 'n_tokens_neox': 352, 'n_words': 95}