Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/MHSanaei/3x-ui.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xray/log_writer.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/xray/log_writer.go b/xray/log_writer.go
index c2f66e8f..5fc6b3d1 100644
--- a/xray/log_writer.go
+++ b/xray/log_writer.go
@@ -20,8 +20,13 @@ func (lw *LogWriter) Write(m []byte) (n int, err error) {
lw.lastLine = messages[len(messages)-1]
for _, msg := range messages {
+ messageBody := msg
+
// Remove timestamp
- messageBody := strings.TrimSpace(strings.SplitN(msg, " ", 3)[2])
+ splittedMsg := strings.SplitN(msg, " ", 3)
+ if len(splittedMsg) > 2 {
+ messageBody = strings.TrimSpace(strings.SplitN(msg, " ", 3)[2])
+ }
// Find level in []
startIndex := strings.Index(messageBody, "[")