PHP code example of roadrunner / app-logger

1. Go to this page and download the library: Download roadrunner/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 / app-logger example snippets


use Spiral\Goridge\RPC\RPC;
use Spiral\RoadRunner\Environment;
use RoadRunner\Logger\Logger;

$rpc = RPC::create('tcp://127.0.0.1:6001');
// or, inside a RoadRunner worker (

/**
 * 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');

$logger->info('User logged in', ['user_id' => 42, 'roles' => ['admin']]);