예제 #1
0
파일: logger.go 프로젝트: hanscj1/martian
// NewLogger returns a logger that logs requests and responses. Log function defaults to martian.Infof.
func NewLogger() *Logger {
	return &Logger{
		log: func(line string) {
			martian.Infof(line)
		},
	}
}
예제 #2
0
// ModifyResponse sets cookie on the response.
func (m *modifier) ModifyResponse(res *http.Response) error {
	res.Header.Add("Set-Cookie", m.cookie.String())
	martian.Infof("%s: add cookie: %s", res.Request.URL, m.cookie)

	return nil
}
예제 #3
0
// ModifyRequest adds cookie to the request.
func (m *modifier) ModifyRequest(req *http.Request) error {
	req.AddCookie(m.cookie)
	martian.Infof("%s: add cookie: %s", req.URL, m.cookie)

	return nil
}