PHP code example of v-dem / queasy-log

1. Go to this page and download the library: Download v-dem/queasy-log 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/ */

    

v-dem / queasy-log example snippets


return [
    'logger' => [
        'class' => queasy\log\FileSystemLogger::class, // Logger class
        'processName' => 'test', // Process name, to differentiate log messages from different sources
        'minLevel' => Psr\Log\LogLevel::WARNING, // Message's minimum acceptable log level
        'path' => 'debug.log' // Path to logger output file
    ]
];



$config = new queasy\config\Config('config.php');

$config = 

$logger = new queasy\log\Logger($config);

$logger = queasy\log\Logger::create($config);

$logger->warning('Test warning message.');

$logger
    ->warning('going strange')
    ->error('cannot connect to the database')
    ->emergency('the website is down');

return [
    [
        'class' => queasy\log\FileSystemLogger::class,
        'path' => 'debug.full.log',
        'minLevel' => Psr\Log\LogLevel::DEBUG,
        [
            'class' => queasy\log\ConsoleLogger::class,
            'minLevel' => Psr\Log\LogLevel::INFO
        ], [
            'class' => queasy\log\SimpleMailLogger::class,
            'minLevel' => Psr\Log\LogLevel::ALERT,
            'mailTo' => '[email protected]',
            'subject' => 'Website Alert'
        ]
    ], [
        'class' => queasy\log\FileSystemLogger::class,
        'path' => 'debug.log',
        'minLevel' => Psr\Log\LogLevel::INFO
    ]
];

$config = new queasy\config\Config('config.php');
$logger = new queasy\log\Logger($config);
$logger->info('Hello, world!');

return [
    [
        'class' => queasy\log\FileSystemLogger::class,
        'path' => 'debug-full.%s.log',
        'timeLabel' => 'Y-m-d',
        'minLevel' => Psr\Log\LogLevel::DEBUG
    ]
];