From 6804facabc27a5dc72a8db22bbaaf2c245161323 Mon Sep 17 00:00:00 2001 From: MHSanaei Date: Sat, 3 Feb 2024 15:24:39 +0330 Subject: bug fix log_writer + notice log level Co-Authored-By: Alireza Ahmadi --- xray/log_writer.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'xray') 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:]) -- cgit v1.2.3