From 89f869dd447d9e10db6dc49b0a8fbb579d81428e Mon Sep 17 00:00:00 2001 From: John Date: Sun, 16 Feb 2020 23:00:42 +0800 Subject: [PATCH] remove internal logging for gsession.StorageFile; improve example codes for CORS feature of ghttp.Server --- .example/net/ghttp/server/cors/cors1.go | 4 +++- .example/net/ghttp/server/cors/cors2.go | 2 +- .example/net/ghttp/server/cors/cors3.go | 2 +- os/gsession/gsession_storage_file.go | 4 ++-- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.example/net/ghttp/server/cors/cors1.go b/.example/net/ghttp/server/cors/cors1.go index a084208dc..afa7c9b8f 100644 --- a/.example/net/ghttp/server/cors/cors1.go +++ b/.example/net/ghttp/server/cors/cors1.go @@ -3,6 +3,7 @@ package main import ( "github.com/gogf/gf/frame/g" "github.com/gogf/gf/net/ghttp" + "github.com/gogf/gf/os/glog" ) func MiddlewareCORS(r *ghttp.Request) { @@ -11,6 +12,7 @@ func MiddlewareCORS(r *ghttp.Request) { } func Order(r *ghttp.Request) { + glog.Println("order") r.Response.Write("GET") } @@ -18,7 +20,7 @@ func main() { s := g.Server() s.Group("/api.v1", func(group *ghttp.RouterGroup) { group.Middleware(MiddlewareCORS) - g.GET("/order", Order) + group.GET("/order", Order) }) s.SetPort(8199) s.Run() diff --git a/.example/net/ghttp/server/cors/cors2.go b/.example/net/ghttp/server/cors/cors2.go index 4dbd12162..f6b4b95ec 100644 --- a/.example/net/ghttp/server/cors/cors2.go +++ b/.example/net/ghttp/server/cors/cors2.go @@ -20,7 +20,7 @@ func main() { s := g.Server() s.Group("/api.v1", func(group *ghttp.RouterGroup) { group.Middleware(MiddlewareCORS) - g.GET("/order", Order) + group.GET("/order", Order) }) s.SetPort(8199) s.Run() diff --git a/.example/net/ghttp/server/cors/cors3.go b/.example/net/ghttp/server/cors/cors3.go index 961d9b242..f9e0e348e 100644 --- a/.example/net/ghttp/server/cors/cors3.go +++ b/.example/net/ghttp/server/cors/cors3.go @@ -26,7 +26,7 @@ func main() { s := g.Server() s.Group("/api.v1", func(group *ghttp.RouterGroup) { group.Middleware(MiddlewareCORS) - g.GET("/order", Order) + group.GET("/order", Order) }) s.SetPort(8199) s.Run() diff --git a/os/gsession/gsession_storage_file.go b/os/gsession/gsession_storage_file.go index f1c93b873..fd6f18ec8 100644 --- a/os/gsession/gsession_storage_file.go +++ b/os/gsession/gsession_storage_file.go @@ -73,7 +73,7 @@ func NewStorageFile(path ...string) *StorageFile { } // Batch updates the TTL for session ids timely. gtimer.AddSingleton(DefaultStorageFileLoopInterval, func() { - intlog.Print("StorageFile.timer start") + //intlog.Print("StorageFile.timer start") var id string var err error for { @@ -84,7 +84,7 @@ func NewStorageFile(path ...string) *StorageFile { intlog.Error(err) } } - intlog.Print("StorageFile.timer end") + //intlog.Print("StorageFile.timer end") }) return s }