VividCortex / siesta

Composable framework for writing HTTP handlers in Go.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Do not log

Preetam opened this issue · comments

It should be up to the user to add logging, in my opinion. They might be using a different logging package anyway.

I think this go-sql-driver/mysql#179 is a good
inspiration.

I don't think logging is this package's responsibility. You can do that with middleware.

I think Route() should return an error instead of this panic-or-log stuff that we have right now:

siesta/service.go

Lines 131 to 135 in 713eddf

if _, ok := s.handlers[re]; ok {
panic("already registered handler for " + verb + " " + pattern)
} else {
log.Println("Handling", expr)
}

#14 fixed this. The behavior right now is to not do anything. We don't see any errors in the Route() function, so we can't know when something fails. The routing tree behavior is to panic when adding a new route, and I'm not sure if we want to change that right now (if at all).