PHP code example of the_alex_mark / laravel-logging
1. Go to this page and download the library: Download the_alex_mark/laravel-logging 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/ */
the_alex_mark / laravel-logging example snippets
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use Monolog\Processor\HostnameProcessor;
use Monolog\Processor\WebProcessor;
use ProgLib\Logging\Via\CustomizeJsonLogger;
class AppServiceProvider extends ServiceProvider {
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot() {
$this->app->get('config')->set("logging.channels.custom", [
'name' => 'custom',
'driver' => 'custom',
'via' => CustomizeJsonLogger::class,
'path' => storage_path("logs/json/laravel.json"),
'level' => 'debug',
'permission' => 0755,
'locking' => true,
'days' => 30,
'processors' => [
HostnameProcessor::class,
WebProcessor::class
]
]);
}
}
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use ProgLib\Logging\Taps\CustomizeLineFormatter;
class AppServiceProvider extends ServiceProvider {
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot() {
$this->app->get('config')->set("logging.channels.custom", [
'name' => 'custom',
'driver' => 'daily',
'path' => storage_path("logs/laravel.log"),
'level' => 'debug',
'permission' => 0755,
'locking' => true,
'days' => 30,
'tap' => [ CustomizeLineFormatter::class ]
]);
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.