stbz/library
胜天半子内部调用库
地址
https://gitlab.jxhh.com/stbz/library
限制
golang版本 >= 1.16
使用方法
package main
import (
"github.com/gogf/gf/net/ghttp"
logs "gitlab.jxhh.com/stbz/library.git/logs"
)
//记录普通日志
logs.Info("存储路径", "格式","格式信息")
requestId := logs.CreateRequestId() //初始化请求id
responseTime := time.Now().UnixNano()/1e6 - r.EnterTime //响应时间 毫秒级
//组装请求日志参数
requestLogreq := logs.RequestLogReq{
"request",r.RequestURI,requestId,r.Method, string(r.GetBody()), r.Response.BufferString(),r.GetError(), r.GetHeader("service_name"),responseTime,
}
logs.RequestLog(requestLogreq) //记录请求日志