PHP code example of virtua / shopware-basic-app-logger-bundle

1. Go to this page and download the library: Download virtua/shopware-basic-app-logger-bundle 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/ */

    

virtua / shopware-basic-app-logger-bundle example snippets


Virtua\ShopwareBasicAppLoggerBundle\ShopwareBasicAppLoggerBundle::class => ['all' => true]

use Virtua\ShopwareBasicAppLoggerBundle\Service\Logger;
use Virtua\ShopwareBasicAppLoggerBundle\Util\LoggerData;

/* ... */

public function __construct(Logger $logger)
{
	$this->logger = $logger;
}

/* ... */

public function exampleFunction(): void
{
	$loggerData = new LoggerData($shopId);
	$loggerData->setMessage("shopware.app.error"); //Use your appication name to identify error in logEntry
	$loggerData->setLevel(404);   //This is optional, default code is 400
	$loggerData->setContext('Your Error message', $errorData ); //errorData is optional parameter to pass additional error informations as array
	$this->logger->log($loggerData);  
}