mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-02 21:41:19 +08:00
added check for undefined application to log Target
allows using logger without a Yii application now. close #6739
This commit is contained in:
committed by
Carsten Brandt
parent
ee85dba92e
commit
b33824044f
@ -20,6 +20,7 @@ Yii Framework 2 Change Log
|
||||
- Enh #6467: `ActiveForm` will scroll to the nearest visible element when the first error input is hidden (newartix)
|
||||
- Enh #6488: Support changing `yii\base\Theme::basePath` during runtime (qiangxue)
|
||||
- Enh #6618: Added Model::addErrors() (slavcodev, pana1990)
|
||||
- Enh #6739: Log `Target` now works also when there is no `Yii::$app` instance available, no message prefix will be added in this case (schmunk42)
|
||||
- Chg #6427: In case of invalid route web application now throws exception with "Page not found" instead of "Invalid Route" (cebe, samdark)
|
||||
- Chg #6641: removed zero padding from ETag strings (DaSourcerer)
|
||||
- Chg #6678: `yii\behaviors\SluggableBehavior` will generate a new slug only when the slug attribute is empty or the source attribute is changed (qiangxue)
|
||||
|
||||
@ -266,6 +266,10 @@ abstract class Target extends Component
|
||||
return call_user_func($this->prefix, $message);
|
||||
}
|
||||
|
||||
if (Yii::$app === null) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$request = Yii::$app->getRequest();
|
||||
$ip = $request instanceof Request ? $request->getUserIP() : '-';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user