定制 virtua/shopware-app-logger-bundle 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

virtua/shopware-app-logger-bundle

Composer 安装命令:

composer require virtua/shopware-app-logger-bundle

包简介

Add basic logger for Shopware application

README 文档

README

Description

This bundle contains fully functional logger for Shopware Applications.

Requirements

  • PHP >= 8.0
  • Symfony 6
  • ShopwareShop Entity

Installation

  • Add bundle repository to composer.json
"virtua/shopware-app-logger-bundle": "^1.0"
  • Add bundle to bundles.php
Virtua\ShopwareAppLoggerBundle\VirtuaShopwareAppLoggerBundle::class => ['all' => true]
  • Add bundle routes to routes.yaml
shopware_app_logger_bundle_routes:
    resource: "@VirtuaShopwareAppLoggerBundle/Resources/config/routes.yaml"
  • Create new file config/packages/virtua_shopware_app_logger.yaml, with data:
imports:
    - { resource: '@VirtuaShopwareAppLoggerBundle/Resources/config/config.yml' }
  • Run migrations bin/console doctrine:migrations:migrate

Usage

#####Writing This bundle is fully functional right after installation. To create new log, use log() method from Logger service. As a paremeter you have to provide LoggerData object, which can be found in Util directory.

Example log() usage:

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

/* ... */

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

/* ... */

public function exampleFunction(): void
{
	$loggerData = new LoggerData($shopId);
	$loggerData->setErrorMessage("Your error message");
	$loggerData->setErrorCode(404);   //This is optional, default code is 400
	$this->logger->log($loggerData);
}

#####Reading Logs are displayed in /logs/list/{shopId} route, implemented in AppLoggerController To add this into menu in your Shopware, you need to add new module in your app manifest.

Example module in manifest.xml:

<module name="logsModule"
    source="https://your_app_url/logs/list"
    parent="sw-extension"
    position="50"
>
    <label>Logs</label>
    <label lang="de-DE">Logs</label>
    <label lang="pl-PL">Logi</label>
</module>
```layed in **/logs/list/{shopId}** route, implemented in **AppLoggerController**

统计信息

  • 总下载量: 95
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-06-15

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固