WebsocketRead implements WebsocketPrinter.WebsocketRead.
(typ int, content []byte, closeCode int)
| 154 | |
| 155 | // WebsocketRead implements WebsocketPrinter.WebsocketRead. |
| 156 | func (p DebugPrinter) WebsocketRead(typ int, content []byte, closeCode int) { |
| 157 | b := &bytes.Buffer{} |
| 158 | fmt.Fprintf(b, "<- Received: %s", wsMessageType(typ)) |
| 159 | if typ == websocket.CloseMessage { |
| 160 | fmt.Fprintf(b, " %s", wsCloseCode(closeCode)) |
| 161 | } |
| 162 | fmt.Fprint(b, "\n") |
| 163 | if len(content) > 0 { |
| 164 | if typ == websocket.BinaryMessage { |
| 165 | fmt.Fprintf(b, "%v\n", content) |
| 166 | } else { |
| 167 | fmt.Fprintf(b, "%s\n", content) |
| 168 | } |
| 169 | } |
| 170 | fmt.Fprintf(b, "\n") |
| 171 | p.logger.Logf(b.String()) |
| 172 | } |
nothing calls this directly
no test coverage detected