PHP code example of dan-d-martin / logger-aware

1. Go to this page and download the library: Download dan-d-martin/logger-aware 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/ */

    

dan-d-martin / logger-aware example snippets


use DanDMartin\LoggerAware\Traits\LoggerAware;

class MyClass
{
	use LoggerAware;

	public function doSomething()
	{
		$this->getLogger()->info('Doing something');
		// do something...
	}
}

$myClass = new MyClass();
$logger = new \Monolog\Logger('logger');

$myClass->setLogger($logger);
$myClass->doSomething();