2017 © Pedro PelΓ‘ez
 

yii2-extension yii2-logs

Logs

image

readly24/yii2-logs

Logs

  • Saturday, June 2, 2018
  • by readly24
  • Repository
  • 0 Watchers
  • 0 Stars
  • 0 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Yii2 Logs

Logs, (*1)

Installation

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)

Usage

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);
            }
    ])?>

The Versions

02/06 2018

dev-master

9999999-dev

Logs

  Sources   Download

MIT

The Requires

 

by Jakharbek
by utkir

extension yii2 logs