PHP code example of xtompie / logger

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

    

xtompie / logger example snippets




use Xtompie\Logger\Logger;
$logger = new Logger('./var/log', 'api');
$logger('Hello world');



use Xtompie\Logger\Logger;

class Api
{
    public function __construct(
        protected Logger $logger,
    ) {
        $this->logger = $logger->withName('api');
    }

    public function doSomething()
    {
        $this->logger->__invoke('Hello world');
    }
}