handle.go 656 字节
Newer Older
E
eoLinker API Management 已提交
1 2 3 4
package config_log

import (
	"fmt"
黄孟柱 已提交
5
	module "github.com/eolinker/goku-api-gateway/console/module/config-log"
E
eoLinker API Management 已提交
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
	"net/http"
	"strings"
)

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)

	accessLogHandler := &AccessLogHandler{

	}

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

	return serveMux

}