1 Star 1 Fork 0

程斌 / think-log-driver

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

think-log-driver

think-log-driver

依赖

适用于thinkphp5.1.* php: >=5.6

安装

  1. 安装think-log-driver
composer require kitty168/think-log-driver

使用

  1. 更改配置
    config/log.php 中的配置修改
// 日志记录方式
'type'        => 'LogDb',
// 大于0.5秒的sql将被记录
'slow_sql_time' => 0.5,
// 记录日志的数据库配置,即在database.php中的key
'log_db_connect' => 'log_db',
// 记录慢日志查询的数据表名
'log_table' => 'slow_sql',
// 忽略的操作,在以下数据中的操作不会被记录
'log_action_filters' => [
    // 'index/Index/lst'
],
  1. 创建数据库
    用于记录日志的mysql数据表,如果使用mongodb则无需创建
CREATE TABLE `log_slow_sql` (
	`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
	`host` CHAR(200) NOT NULL DEFAULT '',
	`uri` CHAR(200) NOT NULL DEFAULT '',
	`ip` CHAR(50) NOT NULL DEFAULT '',
	`method` CHAR(50) NOT NULL DEFAULT '',
	`module` CHAR(30) NOT NULL DEFAULT '',
	`controller` CHAR(30) NOT NULL DEFAULT '',
	`action` CHAR(50) NOT NULL DEFAULT '',
	`create_time` INT(11) NOT NULL DEFAULT '0',
	`create_date` DATETIME NULL DEFAULT NULL,
	`runtime` DECIMAL(10,3) UNSIGNED NOT NULL DEFAULT '0.000',
	`sql_list` TEXT NULL,
	`sql_source` TEXT NULL,
	PRIMARY KEY (`id`),
	INDEX `rumtime` (`runtime`)
)
COLLATE='utf8_general_ci'
ENGINE=InnoDB
AUTO_INCREMENT=1
;

更新日志

v1.0.3 (2020-6-9)

  • 修复mongoDb存储格式

v1.0.2 (2020-6-8)

  • 更新namespace为think\log\driver
MIT License Copyright (c) 2020 kitty168 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

think-log-driver是thinkphp5.1的日志驱动扩展,支持mysql,mongodb 。 展开 收起
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
1
https://gitee.com/kitty_18php/think-log-driver.git
git@gitee.com:kitty_18php/think-log-driver.git
kitty_18php
think-log-driver
think-log-driver
master

搜索帮助