PHP code example of geoffroy-aubry / logger

1. Go to this page and download the library: Download geoffroy-aubry/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/ */

    

geoffroy-aubry / logger example snippets


    $aConfig = array(
        'colors' => array(
            'debug'      => "\033[0;35m",
            'error'      => "\033[1;31m",
            'section'    => "\033[1;37m",
            'subsection' => "\033[1;33m",
            'ok'         => "\033[1;32m"
        )
    );
    $oLogger = new ColoredIndentedLogger($aConfig);

    $oLogger->info('{C.section}Start of new section');
    $oLogger->info('Result is {C.ok}OK');

    $oLogger->debug('some debug information…');
    $oLogger->error(new \RuntimeException('Arghhhh!'));

    $oLogger->info('Result is {result}', array('result' => '{C.ok}OK'));

$oLogger->info('Section A+++');
$oLogger->info('Subsection+++');
$oLogger->info('Step 1');
$oLogger->info('Step 2');
$oLogger->info('------Section B+++');

array(
    'colors'               => array(),
    'base_indentation'     => "\033[0;30m┆\033[0m   ",
    'indent_tag'           => '+++',
    'unindent_tag'         => '---',
    'min_message_level'    => \Psr\Log\LogLevel::DEBUG,
    'reset_color_sequence' => "\033[0m",
    'color_tag_prefix'     => 'C.'
);

    
    
    ger\ColoredIndentedLogger;
    
    $aConfig = array(…);
    $oLogger = new ColoredIndentedLogger($aConfig);
    
    $oLogger->info('Hello');
    …
bash
$ php examples/demo.php
bash
$ curl -sS https://getcomposer.org/installer | php
bash
    $ php vendor/bin/phpmd src/ text codesize,design,unusedcode,naming,controversial