Access the underlying Monolog instance used by Laravel with the following snippet:
$monolog = \Log::getMonolog();
For example, when using the
spatie/image-optimizer package, there is an option to include a logger via a class that implements
Psr\Log\LoggerInterface. In the case of a Laravel project it is convenient to output this log data directly to the
laravel.log file by utlizing the existing Monolog instance directly:
use Spatie\ImageOptimizer\OptimizerChainFactory; $optimizerChain = OptimizerChainFactory::create(); $optimizerChain ->useLogger(\Log::getMonolog()) ->optimize($pathToImage);
Knowledge Base is a repository for various notes, guides, and thoughts on a wide range of IT related topics. Read more...
Web development services by Say Web Solutions. Visit website.