Example #1
0
func CreateRollingApplicationLoggers(filename string) {
	rollingWriter, err := nio.NewRollingFileWriterTime(filename, nio.RollingArchiveNone, "", 2, "2006-01-02", nio.RollingIntervalDaily)
	if err != nil {
		log.Fatalf("Application logger '%s' creation failed for %s\n", filename, err.Error())
	}
	Init(rollingWriter, rollingWriter, rollingWriter, rollingWriter)
}
Example #2
0
func requestLogHandler(h http.Handler) http.Handler {
	rollingWriter, err := nio.NewRollingFileWriterTime(Configuration.RequestLog, nio.RollingArchiveNone, "", 2, "2006-01-02", nio.RollingIntervalDaily)
	if err != nil {
		fmt.Errorf("Request logger creation failed for %s", err.Error())
	}
	logHandler := handlers.NewExtendedLogHandler(h, rollingWriter)

	fn := func(w http.ResponseWriter, req *http.Request) {
		logHandler.ServeHTTP(w, req)
	}
	return http.HandlerFunc(fn)
}