예제 #1
0
파일: logging.go 프로젝트: niilo/inkblot
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)
}
예제 #2
0
파일: main.go 프로젝트: niilo/inkblot
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)
}