Giter Club home page Giter Club logo

think-log-driver's Introduction

think-log-driver

thinkphp6的日志驱动支持elastic和mysql,mongodb

es配置

  • es.php
return [
'hosts'=> explode(',',env('ELASTIC.HOST')),//切割多个
'prefix'=>env('ELASTIC.PREFIX','test_'),//
'user'=>env('ELASTIC.USERNAME'),//es的用户名
'passwd'=>env('ELASTIC.PASSWORD'),//es的密码
];
  • log.php
如果使用es type= \think\log\driver\ElasticLog::class
如果使用数据库或者mongo 
type= \think\log\driver\DbLog::class
//写入数据库的表名
'table' => 'logs',
'db_type' => 'mongo', //默认是default
  • 创建数据表
CREATE TABLE `logs` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`log` varchar(2000) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '日志',
`type` varchar(55) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '类型',
`runtime` float(8,0) DEFAULT NULL COMMENT '执行事件',
`created_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;

think-log-driver's People

Contributors

xgs736214763 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.