承接 donsimon/yii2-log-target-file 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

donsimon/yii2-log-target-file

Composer 安装命令:

composer require donsimon/yii2-log-target-file

包简介

Yii 2.0 customizable log message fileTarget

README 文档

README

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,

        'log' => [
        //          'traceLevel' => YII_DEBUG ? 3 : 0,
                    'targets' => [
                          [  
                                'class' => 'donsimon\log\logTargetFile',  
                                'levels' => ['info','warning','error'],
                                'categories' => ['user','application'],
                                'logVars' => ['_GET', '_POST', '_FILES', '_COOKIE', '_SESSION', '_SERVER'],
                                'logFile' => '@backend/runtime/logs/appAndUser.log',
                                'logMessageContainer' =>['timestamp','prefix','level','category','message'],
                                'prefixContainer'=>['ip','userId','sessionId']
                            ]
                    ],
        ],

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.

Refer more

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

统计信息

  • 总下载量: 88
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 4
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2018-10-30

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固