/** * @inheritdoc */ public function init() { $this->_logsEnabled = true; $this->_logsLevels = CLogger::LEVEL_PROFILE; $this->_logsCategories = 'system.db.CDbCommand.*'; parent::init(); }
/** * @inheritdoc */ public function init() { parent::init(); Yii::app()->mailer->attachEventHandler(BaseMailer::EVENT_AFTER_SEND, function ($event) { /* @var $message MessageInterface */ $message = $event->params['message']; $messageData = ['isSuccessful' => $event->params['isSuccessful'], 'from' => $this->convertParams($message->getFrom()), 'to' => $this->convertParams($message->getTo()), 'reply' => $this->convertParams($message->getReplyTo()), 'cc' => $this->convertParams($message->getCc()), 'bcc' => $this->convertParams($message->getBcc()), 'subject' => $message->getSubject(), 'charset' => $message->getCharset()]; // add more information when message is a SwiftMailer message if ($message instanceof \bashkarev\swiftmailer\swift\Message) { /* @var $swiftMessage \Swift_Message */ $swiftMessage = $message->getSwiftMessage(); $body = $swiftMessage->getBody(); if (empty($body)) { $parts = $swiftMessage->getChildren(); foreach ($parts as $part) { if (!$part instanceof \Swift_Mime_Attachment) { /* @var $part \Swift_Mime_MimePart */ if ($part->getContentType() == 'text/plain') { $messageData['charset'] = $part->getCharset(); $body = $part->getBody(); break; } } } } $messageData['body'] = $body; $messageData['time'] = $swiftMessage->getDate(); $messageData['headers'] = $swiftMessage->getHeaders(); } // store message as file $fileName = $event->sender->generateMessageFileName(); $path = Yii::getPathOfAlias($this->mailPath); if (!is_dir($path)) { \CFileHelper::createDirectory($path); } file_put_contents($path . '/' . $fileName, $message->toString()); $messageData['file'] = $fileName; $this->_messages[] = $messageData; }); }
/** * @inheritdoc */ public function init() { $this->_logsEnabled = true; $this->_logsLevels = implode(',', array(CLogger::LEVEL_ERROR, CLogger::LEVEL_INFO, CLogger::LEVEL_WARNING, CLogger::LEVEL_TRACE)); parent::init(); }
/** * @inheritdoc */ public function init() { $this->_logsEnabled = true; $this->_logsLevels = CLogger::LEVEL_PROFILE; parent::init(); }