mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2025-04-19 13:32:24 +00:00
fix log writer crash
Co-Authored-By: Alireza Ahmadi <alireza7@gmail.com>
This commit is contained in:
parent
0824512a46
commit
1f9b3730d4
1 changed files with 6 additions and 1 deletions
|
@ -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, "[")
|
||||
|
|
Loading…
Reference in a new issue