<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
sunvalley-technologies / react-php-file-logger example snippets
use Monolog\Logger;
use React\Stream\WritableResourceStream;
use SunValley\LoopUtil\FileLogger\Monolog\StreamHandler;
$logger = new Logger('name');
$loop = \React\EventLoop\Factory::create();
$logger->pushHandler(new StreamHandler(new WritableResourceStream(STDOUT, $loop)));
$logger->info('Message!!!');
$loop->run();
use Monolog\Logger;
use SunValley\LoopUtil\FileLogger\Monolog\StdIOHandler;
$logger = new Logger('name');
$loop = \React\EventLoop\Factory::create();
$logger->pushHandler(new StdIOHandler($loop));
$logger->info('Message!!!');
$loop->run();
use Monolog\Logger;
use SunValley\LoopUtil\FileLogger\Monolog\FileHandler;
$logger = new Logger('name');
$loop = \React\EventLoop\Factory::create();
$logFile = __DIR__ . '/test.log';
// expect log file like test-1999-12-31.log
$logger->pushHandler(new FileHandler($loop, $logFile));
$logger->info('Message!!!');
$loop->run();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.