@@ -22,16 +22,22 @@ func main() {
2222 //设置gzip开关
2323 //app.SetEnabledGzip(true)
2424
25- //设置路由
26- InitRoute (app .HttpServer )
2725
2826 //InitModule(app)
2927
3028 //app.UseRequestLog()
3129 app .Use (
3230 NewAccessFmtLog ("app" ),
3331 )
34- app .ExcludeUse (NewAccessFmtLog ("appex" ), "/" , "/" )
32+ exAccessFmtLog := NewAccessFmtLog ("appex" )
33+ exAccessFmtLog .Exclude ("/index" )
34+ exAccessFmtLog .Exclude ("/v1/machines/queryIP/:IP" )
35+ app .Use (exAccessFmtLog )
36+
37+ app .ExcludeUse (NewAccessFmtLog ("appex1" ), "/" )
38+
39+ //设置路由
40+ InitRoute (app .HttpServer )
3541
3642 //启动 监控服务
3743 app .SetPProfConfig (true , 8081 )
@@ -50,13 +56,16 @@ func main() {
5056func Index (ctx dotweb.Context ) error {
5157 ctx .Response ().Header ().Set ("Content-Type" , "text/html; charset=utf-8" )
5258 //fmt.Println(time.Now(), "Index Handler")
53- err := ctx .WriteString ("index => " , fmt . Sprint ( ctx .RouterNode ().Middlewares () ))
59+ err := ctx .WriteString ("index => " , ctx .Request ().Url ( ))
5460 fmt .Println (ctx .RouterNode ().GroupMiddlewares ())
5561 return err
5662}
5763
5864func InitRoute (server * dotweb.HttpServer ) {
5965 server .Router ().GET ("/" , Index )
66+ server .Router ().GET ("/index" , Index )
67+ server .Router ().GET ("/v1/machines/queryIP/:IP" , Index )
68+ server .Router ().GET ("/v1/machines/queryIP2" , Index )
6069 server .Router ().GET ("/use" , Index ).Use (NewAccessFmtLog ("Router-use" ))
6170
6271 g := server .Group ("/group" ).Use (NewAccessFmtLog ("group" )).Use (NewSimpleAuth ("admin" ))
0 commit comments