From 9d854c0f255659b6e21bcfc1eba66868c6ed5f07 Mon Sep 17 00:00:00 2001 From: Carsten Brandt Date: Wed, 6 Sep 2017 09:32:50 +0200 Subject: [PATCH] improved docs for #14273 --- framework/log/Target.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/framework/log/Target.php b/framework/log/Target.php index 1488c4dc45e..88c324a87b8 100644 --- a/framework/log/Target.php +++ b/framework/log/Target.php @@ -313,6 +313,16 @@ public function getMessagePrefix($message) * Sets a value indicating whether this log target is enabled. * @param bool|callable $value a boolean value or a callable to obtain the value from. * The callable value is available since version 2.0.13. + * + * A callable may be used to determine whether the log target should be enabled in a dynamic way. + * For example, to only enable a log if the current user is logged in you can configure the target + * as follows: + * + * ```php + * 'enabled' => function() { + * return !Yii::$app->user->isGuest; + * } + * ``` */ public function setEnabled($value) {