PHP code example of roadrunner-php / app-logger
1. Go to this page and download the library: Download roadrunner-php/app-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/ */
roadrunner-php / app-logger example snippets
use Spiral\Goridge\RPC\RPC;
use RoadRunner\Logger\Logger;
$rpc = RPC::create('tcp://127.0.0.1:6001');
// or
$rpc = RPC::fromGlobals();
// or
$rpc = RPC::fromEnvironment(new \Spiral\RoadRunner\Environment([
'RR_RPC' => 'tcp://127.0.0.1:6001'
]));
$logger = new Logger($rpc);
/**
* debug mapped to RR's debug logger
*/
$logger->debug('Debug message');
/**
* error mapped to RR's error logger
*/
$logger->error('Error message');
/**
* log mapped to RR's stderr
*/
$logger->log("Log message \n");
/**
* info mapped to RR's info logger
*/
$logger->info('Info message');
/**
* warning mapped to RR's warning logger
*/
$logger->warning('Warning message');
bash
composer