Is it possible to get channel name inside custom service provider in Laravel? - Hack The Tech - Latest News related to Computer and Technology

Hack The Tech - Latest News related to Computer and Technology

Get Daily Latest News related to Computer and Technology and hack the world.

Sunday, October 8, 2023

Is it possible to get channel name inside custom service provider in Laravel?

is it possible to get "name" like "pythons" or "duplicates" of logging channel in boot method inside the custom service provider in Laravel application?

There is a great comment on how to setup elasticsearch with Laravel How to use monolog ElasticSearchHandler for logging in a Laravel application

e.g. I have two channels defined in logging.php:

    'pythons' => [
        'driver' => 'monolog',
        'handler' => ElasticsearchHandler::class,
        'level' => env('LOG_LEVEL', 'debug'),
        'formatter' => ElasticsearchFormatter::class
    ],

    'duplicates' => [
        'driver' => 'monolog',
        'handler' => ElasticsearchHandler::class,
        'level' => env('LOG_LEVEL', 'debug'),
        'formatter' => ElasticsearchFormatter::class
    ],

I would like to have a custom $type instead of using a general one: $type = config('elastic_log.type');

Thank you.



source https://stackoverflow.com/questions/77251045/is-it-possible-to-get-channel-name-inside-custom-service-provider-in-laravel

No comments:

Post a Comment