handle.go 671 字节
Newer Older
Y
Your Name 已提交
1
package configlog
E
eoLinker API Management 已提交
2 3 4

import (
	"fmt"
黄孟柱 已提交
5
	module "github.com/eolinker/goku-api-gateway/console/module/config-log"
E
eoLinker API Management 已提交
6 7 8 9
	"net/http"
	"strings"
)

Y
Your Name 已提交
10
//Handle 处理器
E
eoLinker API Management 已提交
11 12 13 14 15 16 17 18 19 20 21 22 23 24
func Handle(prefix string) http.Handler {

	pre := strings.TrimSuffix(prefix, "/")
	serveMux := http.NewServeMux()
	consoleLogHandler := &LogHandler{
		name: module.ConsoleLog,
	}

	serveMux.Handle(fmt.Sprintf("%s/%s", pre, "console"), consoleLogHandler)
	nodeLogHandler := &LogHandler{
		name: module.NodeLog,
	}
	serveMux.Handle(fmt.Sprintf("%s/%s", pre, "node"), nodeLogHandler)

Y
Your Name 已提交
25
	accessLogHandler := &AccessLogHandler{}
E
eoLinker API Management 已提交
26 27 28 29 30 31

	serveMux.Handle(fmt.Sprintf("%s/%s", pre, "access"), accessLogHandler)

	return serveMux

}