高热共公日志库
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
liangzy 3fc7c01156 更新read me il y a 4 ans
logs v1.2.1 增加es管道写入日志 il y a 4 ans
.gitignore v1.2.0 整个beegolog 打进去, 增加syncmap日志通道 il y a 4 ans
README.md 更新read me il y a 4 ans
config.go v1.2.1 增加es管道写入日志 il y a 4 ans
funtion.go v1.2.1 增加es管道写入日志 il y a 4 ans
log.go v1.2.1 增加es管道写入日志 il y a 4 ans
log_test.go v1.2.1 增加es管道写入日志 il y a 4 ans
options.go 优化 il y a 4 ans

README.md

grlogs

本库为争游内部日志公共库

代码示例

  1. 引入
import "golib.gaore.com/GaoreGo/grlogs"
  1. 简单用法
 grlogs.Get("test", 128).Info("hello word")
 grlogs.Get("test").Warning("hello word")

Get 方法中 lable 参数为标签,为识别分类所用,在Grlogs里一个分类使用一个管道进行日志

  1. 进阶用法
logger := grlogs.GetEs("wifi")
logger.SetAdapter(LevelAll, AdapterElasticSearch)
logger.SetAdapter(LevelInfo, AdapterFile)
logger.Critical("出错了")
logger.Info("出错了")
  1. 如果需要写入es, 必须设置环境变量 GRLOG_APP_NAME, 不能有反斜杠, 如
export GRLOG_APP_NAME=mkt.gaore.com;
  1. 文件日志会写入到 ./runtime/logs/ 文件夹 请务必在项目构建阶段创建该目录