cusodede / yii2-log-filetarget
Extended Yii2 Log FileTarget
Installs: 1
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 1
Open Issues: 0
Type:yii2-extension
Requires
- php: >=8.0
- yiisoft/yii2: ~2.0.0
Requires (Dev)
- codeception/codeception: ^4.1
- codeception/module-asserts: ^1.3
- codeception/module-yii2: ^1.1
- phpunit/phpunit: ^9.5
- yiisoft/yii2-bootstrap4: ~2.0.10
This package is auto-updated.
Last update: 2024-10-28 20:53:19 UTC
README
Some useful helpers for Yii2 framework
Installation
The preferred way to install this extension is through composer.
Run
php composer.phar require cusodede/yii2-log-filetarget "^1.0.0"
or add
"cusodede/yii2-log-filetarget": "^1.0.0"
to the require section of your composer.json
file.
Requirements
PHP >= 8.0
Usage
This log target is totally like default Yii2 file target, but it can accept function as the logFile
parameter.
[ 'components' => [ 'log' => [ 'targets' => [ [ 'class' => cusodede\log\FileTarget\FileTarget::class, 'logFile' => fn():string => '@app/runtime/logs/'.date('YmdH').'/ot-'.date('YmdHi').'.log', ] ], ], ... ];
Note that log file name will be generated, when Yii logger is flushed (see \yii\log\Logger::flush()
), and
not when message is logged.