PHP code example of toeswade / log

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

    

toeswade / log example snippets


$Clog = new Toeswade\Log\Clog();

class Test 
{
	private $logger;

	public function __construct( \Toeswade\Log\Clog $Clog) {
		$this->logger = $Clog;
	}

	/*
	 * Some method
	 */
	public function test() {
		$this->logger->stamp(__CLASS__, __METHOD__, 'Method starts');
		// Some code
		$this->logger->stamp(__CLASS__, __METHOD__, 'Method ends');
	}
}

echo $Clog->renderLog();

        $this->setShared('logger', function () {
            $logger = new \Toeswade\Log\Clog();
            return $logger;
        });

    public function render()
    {
        $this->di->logger->stamp(__CLASS__, __METHOD__, 'render starts');

        //...

        $this->di->logger->stamp(__CLASS__, __METHOD__, 'render ends');
    }

// Render the response using theme engine.
$app->theme->render();
echo $app->logger->renderLog();