MCPcopy Create free account
hub / github.com/baidu/EasyFaaS / stdlogHandler

Method stdlogHandler

pkg/controller/rtctrl/dispatcherv2.go:119–138  ·  view source on GitHub ↗
(logfrom int)

Source from the content-addressed store, hash-verified

117}
118
119func (s *DispatchServerV2) stdlogHandler(logfrom int) func(w http.ResponseWriter, r *http.Request) {
120 return func(w http.ResponseWriter, r *http.Request) {
121 conn, buf, ok := setupHijackConn(w, r)
122 if !ok {
123 return
124 }
125 defer conn.Close()
126
127 runtimeid := r.Header.Get("x-cfc-runtimeid")
128 logs.Infof("stdlogHandler runtimeid %s logfrom %d connect", runtimeid, logfrom)
129 defer logs.Infof("stdlogHandler runtimeid %s logfrom %d disconnect", runtimeid, logfrom)
130 m, ok := s.storeMap.getMap(runtimeid)
131 if !ok {
132 logs.Errorf("stdlogHandler can't get map runtimeid %s", runtimeid)
133 return
134 }
135 logDispatcher := m.NewStdLogDispatcher(runtimeid, logfrom, buf, 0)
136 logDispatcher.Read()
137 }
138}
139
140func (s *DispatchServerV2) statisticHandler(w http.ResponseWriter, r *http.Request) {
141 conn, _, ok := setupHijackConn(w, r)

Callers 2

TestStdlogHandlerFunction · 0.95

Calls 8

InfofFunction · 0.92
ErrorfFunction · 0.92
setupHijackConnFunction · 0.85
getMapMethod · 0.80
NewStdLogDispatcherMethod · 0.80
CloseMethod · 0.65
GetMethod · 0.65
ReadMethod · 0.45

Tested by 1

TestStdlogHandlerFunction · 0.76