Browse Source

Fix logger error message and timeout

Vova Tkach 5 years ago
parent
commit
9d9d68f679
2 changed files with 4 additions and 4 deletions
  1. 2 2
      logger/handler.go
  2. 2 2
      logger/logger.go

+ 2 - 2
logger/handler.go

@@ -46,8 +46,8 @@ func (this handler) log(w *writer, r *http.Request) {
 		return
 	case this.c <- logMsg{r.Host, msg, w.status >= 400}:
 		return
-	case <-time.After(1 * time.Second):
-		fmt.Println("Logger error, log channel is overflowed (2)")
+	case <-time.After(2 * time.Second):
+		fmt.Printf("Logger, can't write to file (overflow): %s\n", msg)
 		return
 	}
 }

+ 2 - 2
logger/logger.go

@@ -151,8 +151,8 @@ func (this *Logger) Log(msg string, r *http.Request, isError bool, vars ...inter
 		return
 	case this.cdata <- logMsg{host, msg, isError}:
 		return
-	case <-time.After(1 * time.Second):
-		fmt.Println("Logger error, log channel is overflowed (1)")
+	case <-time.After(2 * time.Second):
+		fmt.Printf("Logger, can't send msg (overflow): %s, %s, %v\n", host, msg, isError)
 		return
 	}
 }