dev-master
9999999-devLogs
MIT
The Requires
by Jakharbek
by utkir
extension yii2 logs
Logs
Logs, (*1)
The preferred way to install this extension is through composer., (*2)
Either run, (*3)
php composer.phar require --prefer-dist readly24/yii2-logs "*"
or add, (*4)
"readly24/yii2-logs": "*"
to the require section of your composer.json
file., (*5)
Once the extension is installed, simply use it in your code by :, (*6)
ΠΠ°ΠΌ Π½ΡΠΆΠ½ΠΎ ΡΠ΄Π΅Π»Π°ΡΡ ΠΌΠΈΠ³ΡΠ°ΡΠΈΡ:, (*7)
yii migrate --migrationPath=@vendor/ready24/yii2-logs/src/migrations
ΠΡΠ»ΠΈ Π²Ρ Ρ ΠΎΡΠΈΡΠ΅ ΠΏΡΠΈΠΌΠ΅Π½ΠΈΡΡ ΠΊ ΠΎΠΏΡΠ΅Π΄Π΅Π»ΡΠ½ΠΎΠΌΡ ΡΠ°Π±Π»ΠΈΡΡ Π²Π°ΠΌ Π½ΡΠΆΠ½ΠΎ ΡΠΎΠ·Π΄Π°ΡΡ ΡΠ²ΡΠ·Ρ ΠΌΠ΅ΠΆΠ΄Ρ Π½ΠΈΠΌΠΈ ΠΈ Π² ΡΠΎΠΉ ΠΌΠΎΠ΄Π΅Π»ΠΈ (ActiveRecord) ΡΠ°Π±Π»ΠΈΡΡ, ΡΠ΅Π°Π»ΠΈΠ·ΠΎΠ²Π°ΡΡ ΠΈΠ½ΡΠ΅ΡΡΠ΅ΠΉΡ LogInterface, (*8)
ΠΠΎΡΠ»Π΅ Π²Π°ΠΌ Π½ΡΠΆΠ½ΠΎ Π΄ΠΎΠ±Π°Π²ΠΈΡΡ Π² Π²Π°Ρ ΠΊΠ»Π°ΡΡ Π½ΠΎΠ²ΠΎΠ΅ ΠΏΠΎΠ²Π΅Π΄Π΅Π½ΠΈΠ΅:, (*9)
ready24\logs\behaviors\LogBehavior
ΠΈ ΡΠΎΠ³Π΄Π° Π²Ρ ΡΠΌΠΎΠΆΠ΅ΡΠ΅ Π΄ΠΎΠ±Π°Π²ΠΈΡΡ Π½ΠΎΠ²ΡΠΉ Π»ΠΎΠ³ ΠΈΠΌΠ΅Π½ΠΎ ΠΊ ΡΡΠΎΠΉ ΠΌΠΎΠ΄Π΅Π»ΠΈ, (*10)
$task = Tasks::findOne(1); $task->createLog("ΠΠ°Ρ Π»ΠΎΠ³");
ΠΈΠ»ΠΈ Π΅ΡΠ»ΠΈ Π²Π°ΠΌ Π½Π΅ Π½ΡΠΆΠ½ΠΎ Π΄Π°Π½Π½ΠΎΠ΅ ΡΠ΄ΠΎΠ±ΡΡΠ²ΠΎ Π²Ρ ΠΌΠΎΠΆΠ΅ΡΠ΅ ΠΈΡΠΏΠΎΠ»ΡΠ·ΠΎΠ²Π°ΡΡ ΡΡΠ°ΡΠΈΡΡΠ΅ΡΠΊΠΈΠΉ ΠΌΠ΅ΡΠΎΠ΄ ΠΊΠ»Π°ΡΡΠ° Logs, (*11)
/** @param mixed $message @param LogInterface|ActiveRecord $model */ Logs::create($message,$model = null);
ΠΡΠΈΠΌΠ΅Ρ 1:, (*12)
<?=\ready24\logs\widgets\LogWidget::widget([ 'model' => $model, 'view' => '@your/path/to/view', 'provider' => [ 'pagination' => [ 'pageSize' => 20 ] ] ])?>
view, (*13)
/** * @var \ready24\logs\models\Logs $log * @var \yii\db\ActiveRecord $model * @var \yii\data\BaseDataProvider $provider */ echo ListView::widget([ 'dataProvider' => $provider, 'itemOptions' => ['class' => 'item'], 'itemView' => function ($log, $key, $index, $widget) use ($model) { return $log->render($model); } ]);
ΠΡΠΈΠΌΠ΅Ρ 2:, (*14)
<?=\ready24\logs\widgets\LogListWidget::widget([ 'model' => $model, 'provider' => [ 'pagination' => [ 'pageSize' => 20 ] ], 'itemOptions' => ['class' => 'item'], 'itemView' => function ($log, $key, $index, $widget) use ($model) { return $log->render($model); } ])?>
Logs
MIT
extension yii2 logs