it/swift-mailer-logger-bundle

SwiftMailer 电子邮件的简单 Monolog 和数据库日志器

1.1 2017-06-14 14:29 UTC

This package is not auto-updated.

Last update: 2024-09-14 19:25:51 UTC


README

SwiftMailer 发送的所有电子邮件的日志记录的 Symfony2 Bundle。

安装

使用 composer 安装

composer require it/swift-mailer-logger-bundle

在项目中启用该包

// app/AppKernel.php
public function registerBundles()
{
    $bundles = array(
        // ...
        new IT\SwiftMailerLoggerBundle\ITSwiftMailerLoggerBundle(),
        // ...
    );
}

配置

将以下行添加到您的 config.yml

# app/config/config.yml

it_swift_mailer_logger:
    level:              debug          # Default to "info"
    type:               rotating_file  # Default to "rotating_file"
    path:               ~              # Default to "%kernel.logs_dir%/mailer.%kernel.environment%.log"
    max_files:          15             # Défault to 10
#    enable_db_logger:  false          # Default to false. Set it to true to enable the database logger

用法

当发送电子邮件时,将自动创建并填充日志文件。打开数据库日志器以将所有发送的电子邮件记录到数据库。

警告:如果您想使用数据库日志器,请务必使用以下命令更新您的数据库

php app/console doctrine:schema:update --dump-sql --force