I can use assertions, remove the switches, and remove the responseWriterHijacker interface, but I think I need to keep the loggingResponseWriter interface around. If it's the duplicated reimplementations of the http.ResponseWriter methods, I can embed a responseLogger in the hijackLogger and only implement the Hijack method.

```go
func (h loggingHandler) ServeHTTP(w http.ResponseWriter, req *http.Request) {
	t := time.Now()
	var logger loggingResponseWriter
	if _, ok := w.(http.Hijacker); ok {
		logger = &hijackLogger{responseLogger{w: w}}
	} else {
		logger = &responseLogger{w: w}
	}
	h.handler.ServeHTTP(logger, req)
	writeLog(h.writer, req, t, logger.Status(), logger.Size())
}

//...

type hijackLogger struct {
	responseLogger
}

func (l *hijackLogger) Hijack() (net.Conn, *bufio.ReadWriter, error) {
	h := l.responseLogger.w.(http.Hijacker)
	conn, rw, err := h.Hijack()
	if err == nil && l.responseLogger.status == 0 {
		// The status will be StatusSwitchingProtocols if there was no error and WriteHeader has not been called yet
		l.responseLogger.status = http.StatusSwitchingProtocols
	}
	return conn, rw, err
}
```