github.com/gogf/gf@v1.16.9/.example/os/glog/handler/glog_handler_greylog.go (about) 1 package main 2 3 //import ( 4 // "context" 5 // "github.com/gogf/gf/frame/g" 6 // "github.com/gogf/gf/os/glog" 7 // "github.com/robertkowalski/graylog-golang" 8 //) 9 // 10 //var greyLogClient = gelf.New(gelf.Config{ 11 // GraylogPort: 80, 12 // GraylogHostname: "graylog-host.com", 13 // Connection: "wan", 14 // MaxChunkSizeWan: 42, 15 // MaxChunkSizeLan: 1337, 16 //}) 17 // 18 //// LoggingGreyLogHandler is an example handler for logging content to remote GreyLog service. 19 //var LoggingGreyLogHandler glog.Handler = func(ctx context.Context, in *glog.HandlerInput) { 20 // in.Next() 21 // greyLogClient.Log(in.Buffer.String()) 22 //} 23 // 24 //func main() { 25 // g.Log().SetHandlers(LoggingGreyLogHandler) 26 // 27 // g.Log().Debug("Debugging...") 28 // g.Log().Warning("It is warning info") 29 // g.Log().Error("Error occurs, please have a check") 30 // glog.Println("test log") 31 //}