bluebik / logger
Log seperate folder by level build on monolog/monolog
Installs: 1 187
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 3
Forks: 0
Open Issues: 1
Requires
- graylog2/gelf-php: ~1.5
- monolog/monolog: ^2.0
This package is not auto-updated.
Last update: 2025-03-19 23:58:19 UTC
README
Log seperate folder by level build on monolog/monolog
Installation
$ composer require bluebik/logger
Usage
use Bluebik\Logger\LoggerFactory; class Controller extends BaseController { use AuthorizesRequests, DispatchesJobs, ValidatesRequests; protected $logger; public function __construct() { $this->logger = LoggerFactory::create('action'); } public function index() { $this->logger->action(__METHOD__, "start"); ... } }
Components
There are 3 components including
- Bluebik\Logger\Commands\LogBackup - Command for backup and archive log daily
- Bluebik\Logger\Middleware\AccessLogMiddleware - Middleware to handle access log
- Bluebik\Logger\Traits\CommandLogger - Trait for creating logger of command class
Log Backup Configuration
Edit in app\Console\Kernel.php
protected $commands = [ \Bluebik\Logger\Commands\LogBackup::class, ... ]; protected function schedule(Schedule $schedule) { $schedule->command('log:backup')->daily(); ... }
AccessLogMiddleware Configuration
Edit in app\Http\Kernel.php
protected $middleware = [ \Bluebik\Logger\Middleware\AccessLogMiddleware::class, ... ];
CommandLogger Usage
use Bluebik\Logger\Traits\CommandLogger; class CommandClass extends Command { use CommandLogger; public function handle() { $this->logger->action(__METHOD__, "start"); ... } }