PHP code example of gazatem / glog
1. Go to this page and download the library: Download gazatem/glog library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
gazatem / glog example snippets
'glog' => [
'driver' => 'monolog',
'handler' => \Gazatem\Glog\Glog::class,
],
'stack' => [
'driver' => 'stack',
'channels' => ['single', 'glog'],
],
Gazatem\Glog\Providers\GlogServiceProvider::class
$app->configureMonologUsing(function ($monolog) {
$monolog->pushHandler(new \Gazatem\Glog\Glog());
});
\Gazatem\Glog\Events\MailLog::class => [
\Gazatem\Glog\Listeners\MailListener::class,
],
php artisan vendor:publish --provider="Gazatem\Glog\Providers\GlogServiceProvider"
php artisan migrate
return [
// No need to change it now, thats for future releases!
'service' => env('GLOG_SERVICE', 'local'),
// Secure your log panel
'middlewares' => ['web', 'App\Http\Middleware\LogAccess'],
// glog uses mysql default, but can be choose mongodb
'db_connection' => env('DB_CONNECTION', 'mysql'),
// To create an alert, enter level and channel pair here
// Example: 'notification' => ['test-channel' => ['CRITICAL', 'ALERT']],
'notification' => [],
'mail_subject' => 'Glog notification mail',
'mail_to' => env('MAIL_FROM'),
'translations' => [
'test-channel' => 'A sample channel'
],
// Panel route path
'route-prefix' => 'logs-panel',
// All channels must be entered before to send the API.
'levels' => ['EMERGENCY', 'ALERT', 'CRITICAL', 'ERROR', 'WARNING', 'NOTICE', 'INFO', 'DEBUG'],
'channels' => ['test-channel', 'user.register'],
];
use Log;
Log::info('user.register', ['message' => 'User Registration Controller', 'id' => 23, 'name' => 'John Doe', 'email' => '[email protected] ']);