Commit 6ed8d176 by Alexander Makarov

Adjusted logging guide, fixed examples for email target

parent b79f3821
...@@ -51,7 +51,10 @@ You may configure the targets in application configuration, like the following: ...@@ -51,7 +51,10 @@ You may configure the targets in application configuration, like the following:
'email' => [ 'email' => [
'class' => 'yii\log\EmailTarget', 'class' => 'yii\log\EmailTarget',
'levels' => ['error', 'warning'], 'levels' => ['error', 'warning'],
'emails' => ['admin@example.com'], 'message' => [
'to' => ['admin@example.com', 'developer@example.com'],
'subject' => 'New example.com log message',
],
], ],
], ],
], ],
...@@ -59,9 +62,9 @@ You may configure the targets in application configuration, like the following: ...@@ -59,9 +62,9 @@ You may configure the targets in application configuration, like the following:
] ]
``` ```
In the config above we are defining two log targets: file and email. In both cases we are filtering messages handles by In the config above we are defining two log targets: [[\yii\log\FileTarget|file]] and [[\yii\log\EmailTarget|email]].
these targets by severity. In case of file target we're additionally filter by category. `yii\*` means all categories In both cases we are filtering messages handles by these targets by severity. In case of file target we're
starting with `yii\`. additionally filter by category. `yii\*` means all categories starting with `yii\`.
Each log target can have a name and can be referenced via the [[targets]] property as follows: Each log target can have a name and can be referenced via the [[targets]] property as follows:
......
...@@ -43,7 +43,9 @@ use yii\base\InvalidConfigException; ...@@ -43,7 +43,9 @@ use yii\base\InvalidConfigException;
* 'email' => [ * 'email' => [
* 'class' => 'yii\log\EmailTarget', * 'class' => 'yii\log\EmailTarget',
* 'levels' => ['error', 'warning'], * 'levels' => ['error', 'warning'],
* 'emails' => ['admin@example.com'], * 'message' => [
* 'to' => 'admin@example.com',
* ],
* ], * ],
* ], * ],
* ], * ],
......
...@@ -13,7 +13,7 @@ namespace yii\mail; ...@@ -13,7 +13,7 @@ namespace yii\mail;
* A message represents the settings and content of an email, such as the sender, recipient, * A message represents the settings and content of an email, such as the sender, recipient,
* subject, body, etc. * subject, body, etc.
* *
* Messages are sent by a [[MailerInterface||mailer]], like the following, * Messages are sent by a [[\yii\mail\MailerInterface|mailer]], like the following,
* *
* ~~~ * ~~~
* Yii::$app->mail->compose() * Yii::$app->mail->compose()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment