averor/simple-logger
Simple, lightweight logger for PHP/Laravel apps. Provides an easy API to write log messages with minimal setup, useful for small projects, debugging, or when you want straightforward logging without extra configuration.
\Psr\Log\LoggerInterface, making it suitable for projects requiring basic logging without heavy dependencies (e.g., Monolog, Symfony Logger). Ideal for:
Log::driver() or LoggingChannel).setHandler(), but lacks built-in Laravel integrations (e.g., single channel, stack channel).setHandler() suffice?config/logging.php:
'channels' => [
'simple_logger' => [
'driver' => 'custom',
'via' => \Averor\SimpleLogger\Logger::class,
'handler' => env('LOG_HANDLER', 'file'),
],
],
setHandler(new \Averor\SimpleLogger\Handler\FileHandler('/path/to/logs.log')).setHandler(new \Averor\SimpleLogger\Handler\StreamHandler('php://stdout')).\Averor\SimpleLogger\Handler\AbstractHandler for unique needs.App\Exceptions\Handler or for non-critical logging.simple-logger to validate integration.config/logging.php to route specific channels (e.g., single) to simple-logger.$logger = new StructuredLogger(new \Averor\SimpleLogger\Logger());
Log::channel() support out of the box.config/logging.php.composer require averor/simple-logger.config/logging.php.Log::channel('simple_logger')->info('Test message').log-rotate or logrotate).Log::channel('simple_logger')->useQueue()->info('Async message');
(Requires custom handler implementation.)| Failure Scenario | Impact | Mitigation |
|---|---|---|
| Log file permissions denied | Silent failure; no logs written | Use try-catch in handler or fallback to CLI. |
| Disk full | Handler throws exception | Implement log rotation or disk monitoring. |
| PHP process crashes | Logs lost if not flushed | Ensure flush() is called in shutdown hooks. |
| High log volume | Performance degradation | Throttle logs or switch to async queue. |
| Handler misconfiguration | Logs written to wrong location | Validate handler paths in CI/CD. |
failed job queue).How can I help you explore Laravel packages today?