如何记录每个请求/上下文-Golang

I'm trying to migrate an a web app from Google Appengine to a dedicated server and I've got stuck to the logging issue. Basically I would like to organise the logs per request/context(like on GAE) so that I can easily review the errors/trace on each request. The most advanced logging library I could find is the glog package but still I can't figure it out how to log per request/context.

Each request gives you a http.Request-object to work with.

If you're using sessions, then you'll have a sessions.Session-object to work with.


You will want to use those objects to help log per request/context, as they identify the request / session.