rhyslees/log-channel-laravel

This is my package log-channel-laravel

1.0.1 2023-03-24 17:06 UTC

README

Installation

You can install the package via composer:

composer require rhyslees/log-channel-laravel

Add the following to your config\logging.php file:

'channels' => [
    ...
    
    'logchannel' => [
        'driver' => 'custom',
        'via' => \RhysLees\LogChannelLaravel\LogChannelLaravel::class,
        'key' => env('LOG_CHANNEL_KEY', ''),
        'app_id' => env('LOG_CHANNEL_APP_ID', ''),
        'endpoint' => env('LOG_CHANNEL_ENDPOINT', 'https://logchannel.co.uk/api/app'),
    ],
    
    ...
],

Then add the channel to the stack:

'stack' => [
    'driver' => 'stack',
    'channels' => ['single', 'logchannel'],
    'ignore_exceptions' => false,
],

You can publish the config file with:

php artisan vendor:publish --tag="log-channel-laravel-config"

This is the contents of the published config file:

return [
    'key' => env('LOG_CHANNEL_KEY', ''),
    'app_id' => env('LOG_CHANNEL_APP_ID', ''),
    'endpoint' => env('LOG_CHANNEL_ENDPOINT', 'https://logchannel.co.uk/api/app'),
];

Optionally, you can publish the views using

php artisan vendor:publish --tag="log-channel-laravel-views"

Usage

As Log Channel

As Facade

$logChannelLaravel = new RhysLees\LogChannelLaravel();
echo $logChannelLaravel->echoPhrase('Hello, RhysLees!');

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.