<commit_before><?php

namespace Mushketer888\LaravelDblog;

use Monolog\Logger as Monolog;
use Illuminate\Log\LogServiceProvider as LaravelServiceProvider;

/**
 * Class ServiceProvider
 *
 * @package Mushketer888\LaravelDblog
 * @see http://laravel.com/docs/master/packages#service-providers
 * @see http://laravel.com/docs/master/providers
 */
class ServiceProvider extends LaravelServiceProvider
{
    /**
     * Indicates if loading of the provider is deferred.
     *
     * @see http://laravel.com/docs/master/providers#deferred-providers
     * @var bool
     */
    protected $defer = false;

    /**
     * Register the service provider.
     *
     * @see http://laravel.com/docs/master/providers#the-register-method
     * @return void
     */
    public function register()
    {

        $this->app->singleton('log', function () {


            //var_dump($this->app['events']);
            $log = new \Mushketer888\LaravelDblog\Writer(
                new Monolog($this->channel()), $this->app['events']
            );

            if ($this->app->hasMonologConfigurator()) {
                call_user_func($this->app->getMonologConfigurator(), $log->getMonolog());
            } else {
                $this->configureHandler($log);
            }

            return $log;
        });
    }

    /**
     * Application is booting
     *
     * @see http://laravel.com/docs/master/providers#the-boot-method
     * @return void
     */
    public function boot()
    {
        $this->registerMigrations();
    }

    protected function packagePath($path = '')
    {
        return sprintf("%s/../%s", __DIR__, $path);
    }

    /**
     * Register the package migrations
     *
     * @see http://laravel.com/docs/master/packages#publishing-file-groups
     * @return void
     */
    protected function registerMigrations()
    {
        $this->publishes([
            $this->packagePath('database/migrations') => database_path('/migrations')
        ], 'migrations');
    }


}<commit_msg>Update ServiceProvider.php<commit_after><?php

namespace Mushketer888\LaravelDblog;

use Illuminate\Log\Events\MessageLogged;
use Illuminate\Support\Facades\Event;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Schema;
use Monolog\Logger as Monolog;
use Illuminate\Log\LogServiceProvider as LaravelServiceProvider;

/**
 * Class ServiceProvider
 *
 * @package Mushketer888\LaravelDblog
 * @see http://laravel.com/docs/master/packages#service-providers
 * @see http://laravel.com/docs/master/providers
 */
class ServiceProvider extends LaravelServiceProvider
{

    /**
     * Indicates if loading of the provider is deferred.
     *
     * @see http://laravel.com/docs/master/providers#deferred-providers
     * @var bool
     */
    protected $defer = false;

    /**
     * Register the service provider.
     *
     * @see http://laravel.com/docs/master/providers#the-register-method
     * @return void
     */
    public function register()
    {


    }

    /**
     * Application is booting
     *
     * @see http://laravel.com/docs/master/providers#the-boot-method
     * @return void
     */
    public function boot()
    {
        $this->registerMigrations();
        if (Schema::hasTable('logs')) {
            Event::listen(MessageLogged::class, function (MessageLogged $e) {
                try {
                    \Mushketer888\LaravelDblog\DBLog::create(
                        [
                            'level' => $e->level,
                            'message' => $e->message,
                            'context' => $e->context,
                            'env' => ''
                        ]
                    );
                } catch (\Exception $ex) {

                }
            });
        }

    }

    protected function packagePath($path = '')
    {
        return sprintf("%s/../%s", __DIR__, $path);
    }

    /**
     * Register the package migrations
     *
     * @see http://laravel.com/docs/master/packages#publishing-file-groups
     * @return void
     */
    protected function registerMigrations()
    {
        $this->publishes([
            $this->packagePath('database/migrations') => database_path('/migrations')
        ], 'migrations');
    }


}
{'fraction_non_alphanumeric': 0.13503305004721436, 'fraction_numerical': 0.00424929178470255, 'mean_word_length': 2.0264285714285712, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 29, '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': '1646032', 'n_tokens_mistral': 1255, 'n_tokens_neox': 1222, 'n_words': 208}