示例#1
0
// SetupLogging implements the utils.LogSetup interface so we can use the utils package to
// detect SIGHUP signals to alert us when logrotate is complete.
func (h *accessLogHandler) SetupLogging() {
	h.writer = utils.GetLogFileHandle(h.logFile)
}
示例#2
0
// AccessLogHandler return a http.Handler that wraps h and logs requests to out in
// Apache Combined Log Format...with an NYT twist (SRCIP instead of RemoteAddr if it exists).
//
// See http://httpd.apache.org/docs/2.2/logs.html#combined for a description of this format.
//
// AccessLogHandler always sets the ident field of the log to -
func AccessLogHandler(accessLogName string, h http.Handler) http.Handler {
	logHandler := accessLogHandler{utils.GetLogFileHandle(accessLogName), h, accessLogName}

	go utils.ListenForLogSignal(&logHandler)
	return &logHandler
}