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

Function logWebsocketContext

router.go:715–735  ·  view source on GitHub ↗

get default log string

(ctx Context, timetaken int64)

Source from the content-addressed store, hash-verified

713
714// get default log string
715func logWebsocketContext(ctx Context, timetaken int64) string {
716 var reqbytelen, resbytelen, method, proto, status, userip string
717 if ctx != nil {
718 reqbytelen = convert.Int642String(ctx.Request().ContentLength)
719 resbytelen = "0"
720 method = ctx.Request().Method
721 proto = ctx.Request().Proto
722 status = "0"
723 userip = ctx.RemoteIP()
724 }
725
726 log := method + " "
727 log += userip + " "
728 log += proto + " "
729 log += status + " "
730 log += reqbytelen + " "
731 log += resbytelen + " "
732 log += convert.Int642String(timetaken)
733
734 return log
735}
736
737func logRequest(req *http.Request, timetaken int64) string {
738 var reqbytelen, resbytelen, method, proto, status, userip string

Callers 1

wrapWebSocketHandleMethod · 0.85

Calls 3

Int642StringFunction · 0.92
RequestMethod · 0.65
RemoteIPMethod · 0.65

Tested by

no test coverage detected