diff --git a/internal/core/log.go b/internal/core/log.go index 45e3c88..eba25b2 100644 --- a/internal/core/log.go +++ b/internal/core/log.go @@ -4,6 +4,9 @@ package core import ( + "bufio" + "errors" + "net" "net/http" "os" @@ -61,6 +64,14 @@ func (r *LogRecord) Write(data []byte) (int, error) { return n, err } +func (r *LogRecord) Hijack() (net.Conn, *bufio.ReadWriter, error) { + h, ok := r.ResponseWriter.(http.Hijacker) + if !ok { + return nil, nil, errors.New("hijack not supported") + } + return h.Hijack() +} + // LoggerMiddleware is a middleware function that logs incoming HTTP requests. func (l *Logger) LoggerMiddleware(next http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {