Easy integrate Logz.io into PHP and Laravel 5.6+ Application
- Make Logz.io handler for Monolog
- Make
logzio
driver for integrate Logz.io into Laravel Application
- php >=7.1.3
- Laravel 6.0+ (when using with Laravel)
We tested with Laravel 6.0+ and php 7.2+ . But it can working with Laravel 5.6+ and php >= 7.1.3
Begin by pulling in the package through Composer.
$ composer require oanhnn/laravel-logzio
<?php
use Laravel\Logzio\Log\Handler;
use Monolog\Logger;
$config = [
'token' => '...',
'type' => 'http-bulk',
'ssl' => true,
'region' => '',
];
$logger = new Logger('log-name');
$logger->pushHandler(new Handler(Logger::DEBUG, true, $config);
$logger->info('Some message');
In config/logging.php
file, config you log with driver logzio
<?php
return [
// ...
'custom' => [
'driver' => 'logzio',
'name' => 'channel-name',
'token' => 'logz-access-token',
'type' => 'http-bulk',
'ssl' => true,
'level' => 'info',
'bubble' => true,
'region' => 'eu', // leave empty for default region
'timestamp_format' => '', // leave empty for default format (requires UTC time)
],
// ...
];
In your code using
Log::channel('custom')->info('Some message');
See more in Laravel document
See all change logs in CHANGELOG
$ git clone [email protected]/oanhnn/laravel-logzio.git /path
$ cd /path
$ composer install
$ composer test
Please see CONTRIBUTING for details.
If you discover any security related issues, please email to Oanh Nguyen instead of using the issue tracker.
This project is released under the MIT License.
Copyright © 2020 Oanh Nguyen.