Browse Source

Adjusted logging guide, fixed examples for email target

tags/2.0.0-beta
Alexander Makarov 11 years ago
parent
commit
6ed8d1767c
  1. 11
      docs/guide/logging.md
  2. 4
      framework/yii/log/Logger.php
  3. 2
      framework/yii/mail/MessageInterface.php

11
docs/guide/logging.md

@ -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:
] ]
``` ```
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:

4
framework/yii/log/Logger.php

@ -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',
* ],
* ], * ],
* ], * ],
* ], * ],

2
framework/yii/mail/MessageInterface.php

@ -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()

Loading…
Cancel
Save