defer close files

This commit is contained in:
emile 2015-09-12 15:20:56 +02:00
parent 36847f671f
commit 0881151a44
2 changed files with 11 additions and 3 deletions

View file

@ -29,9 +29,13 @@ func NewLogger(file string) *Logger {
}
func (l *Logger) ServeHTTP(rw http.ResponseWriter, r *http.Request, next http.HandlerFunc) {
if(l.file == nil){
if (l.file == nil) {
next(rw, r)
}else{
}else {
handlers.CombinedLoggingHandler(l.file, next).ServeHTTP(rw, r)
}
}
func (l *Logger) Close() {
l.file.Close()
}