PHP code example of pendenga / log

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

    

pendenga / log example snippets




use Pendenga\Log\EchoLogger;
use Psr\Log\LoggerAwareTrait;
use Psr\Log\LoggerInterface;
use Psr\Log\LogLevel;
use Psr\Log\NullLogger;
er ?? new NullLogger());
    }

    public function bar() {
        $this->logger->debug(__METHOD__);
        // ...
        $this->logger->error(__METHOD__ . " Something Important!", ['code' => 123]);
    }
}

$foo = new Foo(new EchoLogger());
$foo->bar();
echo "---\n";
$foo->setLogger(new EchoLogger(LogLevel::ERROR));
$foo->bar();