1. Go to this page and download the library: Download dotburo/laravel-molog 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/ */
class YourClass {
use \Dotburo\Molog\Traits\Logging;
protected function handle()
{
// This will store three messages
$this->messages()
->message('Import process initiated', \Psr\Log\LogLevel::INFO)
->notice('Import process ongoing')
->warn('Import process aborted')
->save();
// This will store one message with the subject 'aborted' and level critical
$this->message()
->setContext('Import process')
->notice('ongoing')
->warn('aborted')
->setLevel(\Dotburo\Molog\MologConstants::CRITICAL)
->save();
// Associate all subsequent metrics with the last message
$this->gauges()->concerning($this->messages()->last());
// Associate this metric of type INT with the first message
$this->gauge('density', 5)->concerning($this->messages()->first())->save();
// Add three metrics associated with the last message
$this->gauges()
->gauge('density', 5.3567) // updates the previous 'density' metric to the FLOAT value
->gauge('pressure', 2.35, 'bar', \Dotburo\Molog\MologConstants::GAUGE_INT_TYPE) // forcibly cast to FLOAT
->gauge('quality', 3)
->save();
}
}