MCPcopy Create free account
hub / github.com/devfeel/dotweb / logContext

Function logContext

middleware.go:179–199  ·  view source on GitHub ↗

get default log string

(ctx Context, timetaken uint64)

Source from the content-addressed store, hash-verified

177
178// get default log string
179func logContext(ctx Context, timetaken uint64) string {
180 var reqbytelen, resbytelen, method, proto, status, userip string
181 if ctx != nil {
182 reqbytelen = convert.Int642String(ctx.Request().ContentLength)
183 resbytelen = convert.Int642String(ctx.Response().Size)
184 method = ctx.Request().Method
185 proto = ctx.Request().Proto
186 status = convert.Int2String(ctx.Response().Status)
187 userip = ctx.RemoteIP()
188 }
189
190 log := method + " "
191 log += userip + " "
192 log += proto + " "
193 log += status + " "
194 log += reqbytelen + " "
195 log += resbytelen + " "
196 log += convert.UInt642String(timetaken)
197
198 return log
199}
200
201type TimeoutHookMiddleware struct {
202 BaseMiddleware

Callers 1

HandleMethod · 0.70

Calls 6

Int642StringFunction · 0.92
Int2StringFunction · 0.92
UInt642StringFunction · 0.92
RequestMethod · 0.65
ResponseMethod · 0.65
RemoteIPMethod · 0.65

Tested by

no test coverage detected