From 1fcf3d68f1860773bf342f52dcf1a6dfd645cb1d Mon Sep 17 00:00:00 2001 From: Alireza Ahmadi Date: Fri, 2 Feb 2024 17:53:40 +0100 Subject: [PATCH] bug fix log_writer #872 --- xray/log_writer.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xray/log_writer.go b/xray/log_writer.go index 5fc6b3d1..53358ca2 100644 --- a/xray/log_writer.go +++ b/xray/log_writer.go @@ -31,7 +31,7 @@ func (lw *LogWriter) Write(m []byte) (n int, err error) { // Find level in [] startIndex := strings.Index(messageBody, "[") endIndex := strings.Index(messageBody, "]") - if startIndex != -1 && endIndex != -1 { + if startIndex != -1 && endIndex != -1 && startIndex < endIndex { level := strings.TrimSpace(messageBody[startIndex+1 : endIndex]) msgBody := "XRAY: " + strings.TrimSpace(messageBody[endIndex+1:])