PHP code example of orisai / nette-monolog

1. Go to this page and download the library: Download orisai/nette-monolog 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/ */

    

orisai / nette-monolog example snippets


use Psr\Log\LoggerInterface;

final class ImportantCode
{

	private LoggerInterface $logger;

	public function __construct(LoggerInterface $logger)
	{
		$this->logger = $logger;
	}

	public function doSomethingImportant(): void
	{
		try {
			// Dark magic

			$this->logger->info('Everything is fine!');
		} catch (WeHaveAProblemHouston $e) {
			$this->logger->critical('Dumpster fire!', [
				'exception' => $e,
			]);
		}
	}

}