Download the PHP package donsimon/yii2-log-target-file without Composer
On this page you can find all versions of the php package donsimon/yii2-log-target-file. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download donsimon/yii2-log-target-file
More information about donsimon/yii2-log-target-file
Files in donsimon/yii2-log-target-file
Package yii2-log-target-file
Short Description Yii 2.0 customizable log message fileTarget
License BSD-3-Clause
Informations about the package yii2-log-target-file
Yii2 LogTargetFile
Customize the log messages
Sort and change the log message's units
Installation
Just run in your console:
composer require donsimon/yii2-log-target-file "*"
or add
"donsimon/yii2-log-target-file": "*"
to the require section of your composer.json file.
Usage
Add following line to your main configuration file (e.g. config/main.php),
'bootstrap' => ['log'],
Then,
Add following lines to the components section in configuration file,
To write on log file client should call something like this,
Yii::info($message, $category);
Here $message and $category are variables.
your log will update.
What you can do here,
You can change log file name using logFile
.
eg: @backend/runtime/logs/user-activities.log
You can add many categories
.
eg: ['yii\web\HttpException:*','yii\base\ErrorException:*','user','application']
You can add many levels
eg: ['info','warning','error']
You can print vars using logVars
.
New
logMessageContainer
is a array of log messages units ['timestamp','prefix','level','category','message']
.
You can sort and change log messages units using logMessageContainer
prefixContainer
is a array of prefix units ['ip','userId','sessionId']
.
You can sort and change log messages prefix using prefixContainer