adrenalinkin/monolog-autowire-bundle
Symfony bundle that enables autowiring of Monolog channel loggers via generated decorator classes, plus a LoggerCollection fallback mechanism. Works even without MonologBundle: missing channels fall back to the default PSR-3 logger or NullLogger.
monolog/monolog + illuminate/log). However, Laravel’s service container (Laravel’s IoC) differs from Symfony’s, requiring potential abstraction layers.LoggerCollection fallback mechanism could simplify logger management in Laravel’s context.MonologBundle suggests it could integrate cleanly with Laravel’s built-in logging (which uses Monolog under the hood) without requiring additional bundles.Log facade already provides a fluent interface for logging, reducing the immediate need for autowired logger instances. However, the package’s LoggerCollection could still add value for structured logging or multi-channel scenarios.single, group, fingers_crossed) would map directly. The autowiring feature could enable type-hinted logger injection in Laravel’s services.app/Providers/AppServiceProvider vs. bundle-generated classes).ContainerAwareInterface).NullLogger fallback may not align with Laravel’s default behavior (which throws exceptions for missing log channels). This could lead to silent failures or unexpected behavior.Log::channel() or Log::withContext() achieve the same goals without autowiring?make:provider) to mitigate class generation issues?monolog/monolog and illuminate/log. However, Laravel’s Log facade abstracts Monolog, so direct autowiring may require bypassing the facade.HttpKernel or DependencyInjection, integration may be smoother. Pure Laravel projects will need workarounds.vendor/bin structure may require custom binaries or aliases.Log::channel('slow')->error(...)).Log::channel() or context-based logging.public function __construct(private LoggerInterface $logger)).AppServiceProvider to test autowiring feasibility.adrenalinkin/monolog-autowire-laravel).make: commands or runtime code generation).NullLogger fallback to match Laravel’s behavior (e.g., throw exceptions).// config/logging.php
'channels' => [
'single' => [
'driver' => 'single',
'path' => storage_path('logs/laravel.log'),
],
],
// AppServiceProvider
public function register()
{
$this->app->register(MonologAutowireServiceProvider::class);
}
HttpKernel in Laravel (e.g., via symfony/http-kernel) to leverage the bundle natively. Higher complexity, but cleaner for hybrid apps.~2.0).spatie/laravel-logging, laravel-zero/logging).Log::channel() calls, lack of type safety).Log::channel() with autowired loggers in critical services.config/logging.php. Changes here may break autowired loggers if not synchronized.php artisan config:cache) and validate channel definitions in CI.Log::withContext()) could be harder to debug when mixed with autowired loggers.How can I help you explore Laravel packages today?