Skip to content
/ logrus Public
forked from gogap/logrus

DEPRECATED, Please refer to gogap/logrus_mate.logrus修改版,可以配置输出到文件和graylog日志系统 基础的level、调用链、行号,文件切分都有 特色是结构化日志可以被统计和索引,借助graylog就可以做日志分析

License

Notifications You must be signed in to change notification settings

xox9001/logrus

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

logrus


DEPRECATED

Please refer to https://github.com/gogap/logrus_mate

example

package main

import (
	log "github.com/gogap/logrus"
	"github.com/gogap/logrus/hooks/file"
	"github.com/gogap/logrus/hooks/graylog"
)

func main() {
	log.SetFormatter(&log.JSONFormatter{})

	//输出到graylog
	glog, err := graylog.NewHook("boot2docker:9001", "yijifu", nil)
	if err != nil {
		log.Error(err)
		return
	}
	log.AddHook(glog)

	//输出到文件
	log.AddHook(file.NewHook("logs/ss.log"))
	
	//yijifu组件中的member模块的日志
	log.WithField("biz", "member").Errorf("member not login,member is %s", "1001")
}


log in file example

2015/06/29 15:24:52 [ERROR] member not login,member is 1001
github.com/gogap/test_case/logrus.go:23[biz:membe]

log on gray log example

picture

About

DEPRECATED, Please refer to gogap/logrus_mate.logrus修改版,可以配置输出到文件和graylog日志系统 基础的level、调用链、行号,文件切分都有 特色是结构化日志可以被统计和索引,借助graylog就可以做日志分析

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 100.0%