PHP code example of tofex / m2-log
1. Go to this page and download the library: Download tofex/m2-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/ */
tofex / m2-log example snippets
namespace Tofex\Module\Plugin;
use Tofex\Module\Logger\Monolog\ErrorLog;
use Tofex\Module\Logger\Monolog\Log;
use Tofex\Module\Logger\Monolog\SuccessLog;
use Tofex\Log\Logger\Wrapper;
/**
* @author Andreas Knollmann
* @copyright Copyright (c) 2014-2022 Tofex UG (http://www.tofex.de)
* @license http://www.opensource.org/licenses/mit-license.php MIT
*/
class Logging
{
/** @var Log */
private $moduleLog;
/** @var ErrorLog */
private $moduleErrorLog;
/** @var SuccessLog */
private $moduleSuccessLog;
/**
* @param Log $moduleLog
* @param ErrorLog $moduleErrorLog
* @param SuccessLog $moduleSuccessLog
*/
public function __construct(Log $moduleLog, ErrorLog $moduleErrorLog, SuccessLog $moduleSuccessLog)
{
$this->moduleLog = $moduleLog;
$this->moduleErrorLog = $moduleErrorLog;
$this->moduleSuccessLog = $moduleSuccessLog;
}
/**
* @param Wrapper $wrapper
*/
public function afterInitialize(Wrapper $wrapper)
{
$wrapper->addLoggers([$this->moduleLog, $this->moduleErrorLog, $this->moduleSuccessLog]);
}
}