bug fix log_writer #872

This commit is contained in:
Alireza Ahmadi
2024-02-02 17:53:40 +01:00
parent 3c922d8673
commit 1fcf3d68f1

View File

@@ -31,7 +31,7 @@ func (lw *LogWriter) Write(m []byte) (n int, err error) {
// Find level in [] // Find level in []
startIndex := strings.Index(messageBody, "[") startIndex := strings.Index(messageBody, "[")
endIndex := 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]) level := strings.TrimSpace(messageBody[startIndex+1 : endIndex])
msgBody := "XRAY: " + strings.TrimSpace(messageBody[endIndex+1:]) msgBody := "XRAY: " + strings.TrimSpace(messageBody[endIndex+1:])