1. Go to this page and download the library: Download thesebas/stream2log 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/ */
thesebas / stream2log example snippets
class MockLogger extends \Psr\Log\AbstractLogger {
public function log($level, $message, array $context = array()) {
fprintf(STDERR, "[%s] [level:%s] %s", date('c', 0x44884488), $level, strtr($message, $context));
}
}
\thesebas\stream2log\Wrapper::setup();
\thesebas\stream2log\Wrapper::registerLogger('mocklog', new MockLogger());
define("MYERR", fopen("log://mocklog", 'w'));
// regular STDERR output
fprintf(STDERR, "! error message\n"); // ! error message
fprintf(STDERR, "# warning message\n"); // # warning message
fprintf(STDERR, "* info message\n"); // * info message
// writes to MYERR are redirected to and handled by registered logger
fprintf(MYERR, "! error message\n"); // [2006-06-08T15:38:48+00:00] [level:error] error message
fprintf(MYERR, "# warning message\n"); // [2006-06-08T15:38:48+00:00] [level:warning] warning message
fprintf(MYERR, "* info message\n"); // [2006-06-08T15:38:48+00:00] [level:info] info message
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.