/logger

Primary LanguagePHP

Collection

Tool for write logs to file

Requiments

PHP >= 8.0

Installation

Using composer

composer require xtompie/logger

Docs

<?php

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

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');
    }
}