Skip to content
This repository has been archived by the owner on Apr 10, 2022. It is now read-only.

Logging requests #13

Open
njspok opened this issue Aug 2, 2016 · 0 comments
Open

Logging requests #13

njspok opened this issue Aug 2, 2016 · 0 comments

Comments

@njspok
Copy link

njspok commented Aug 2, 2016

I want log requests and specify log targets rules with 'category' parameter. But this component hard code category __METHOD__ and not customize. Maybe create Mailer::logCategory attribute and specify him from config?

    protected function sendMessage($message)
    {
        $address = $message->getTo();
        if (is_array($address)) {
            $address = implode(', ', array_keys($address));
        }

    // log category is string __METHOD__ = 'yashop\ses\Mailer::sendMessage' not pretty  ;(
    Yii::info('Sending email "' . $message->getSubject() . '" to "' . $address . '"', __METHOD__);


        if ( is_null($message->getFrom()) && isset($this->default_from)) {
            if(!is_array($this->default_from)){
                $this->default_from = array($this->default_from => $this->default_from);
            }
            $message->setFrom($this->default_from);
        }
        $res = $this->getSES()->sendEmail($message->getSesMessage());
        $message->setDate(time());
        return count($res) > 0;
    }

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant