PHP code example of productsupcom / flexilog

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

    

productsupcom / flexilog example snippets




roductsup\Flexilog\Logger;
use Productsup\Flexilog\Info;
use Productsup\Flexilog\Handler;

// this is optional
// a Info class allows you to set certain properties that you always
// want to include in your Log output (e.g. Gelf or Shell)
// this is an expanditure to the `$context`.
// You can define specific );


$logger->notice('Hello World');

$context = array(
    'fullMessage' => 'Blablablabla bla blaaaa blaaaa {foo} blaa',
    'foo' => 'bar',
    //'exception' => new \Exception('wut', 0, new \Exception('Previous')),
    'someArray' => array('yo, sup', 'nm nm', 'a' => array('foo', 'bar' => 'baz')),
    'date' => new \DateTime()
);
$logger->message('default message', $context);
$logger->message('critical message', $context, 'critical');

$logger->critical('critical message', $context);

// initialise a few Handlers, use the default verbosity set in the Handler
$shellHandler = new Handler\ShellHandler('trace');
// set the Verbosity to -1, which allows it to be muted
$arrayHandler = new Handler\ArrayHandler('debug', -1);

$logger = new Logger([$shellHandler, $arrayHandler]);

// now send a message where $muted is set to true
$logger->log('debug', 'foobar', ['baz'=>'bar'], true);

$logger->log('trace', $message, $context);

public function execute(InputInterface $input, OutputInterface $output)
{
    $logger = new \Productsup\Logger(
        array(
            'Console' => new \Productsup\Handler\SymfonyConsoleHandler('debug', 2, $output)
        )
    );

    $logger->message('message');
    $logger->error('errrooorrr');
}