Skip to content

having trouble writing a customer logger middleware #782

@atbaig

Description

@atbaig

Description

I am trying to log some custom fields in my custom logger middleware. I took the code from middleware/logger.go and tried to modify it in my own repo. I am getting EOF after I do a c.Bind()

Expected behaviour

I am expecting it work normally

Actual behaviour

I get an EOF after I add the c.Bind()

Steps to reproduce

middleware/logger.go

Working code to debug

return func(next echo.HandlerFunc) echo.HandlerFunc {
return func(c echo.Context) (err error) {
//Begin Custom Code
r1 := &Request{}
if err = c.Bind(&r1); err != nil {
fmt.Println(err)
return err
}
//End Custom code
req := c.Request()
res := c.Response()
start := time.Now()
if err = next(c); err != nil {
c.Error(err) //This is where I get an EOF. If I remove the custom code everything works perfectly
}
Am I doing something wrong?

package main

func main() {
}

Version/commit

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions