PHP code example of dankkomcg / php-logger
1. Go to this page and download the library: Download dankkomcg/php-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/ */
dankkomcg / php-logger example snippets
ankkomcg\Logger\Traits\Console\ConsoleLoggable;
use Dankkomcg\Logger\Types\Console\LightColourConsoleLogger;
$test = new class {
use ConsoleLoggable;
public function checkTest() {
$this->logger()->info('write to file');
}
};
$test->setLogger(
new LightColourConsoleLogger(
[
'info' => 'red'
]
)
);
$test->checkTest();
ankkomcg\Logger\Traits\Console\ConsoleLoggable;
use Dankkomcg\Logger\Types\File\MonologFileLogger;
$test = new class {
use Loggable;
public function checkTest() {
$this->logger()->info('write to file');
}
};
$test->setLogger(
new MonologFileLogger(
dirname(__FILE__) . '/test.log', 'test'
)
);
$test->checkTest();
bash
composer