mirror of
https://github.com/v2fly/v2ray-core.git
synced 2024-12-21 09:36:34 -05:00
🕳 Prevent trailing whitespaces in logs (#526)
This commit is contained in:
parent
29f16cd054
commit
3c988693b5
@ -36,19 +36,23 @@ func (m *AccessMessage) String() string {
|
||||
builder.WriteString(string(m.Status))
|
||||
builder.WriteByte(' ')
|
||||
builder.WriteString(serial.ToString(m.To))
|
||||
builder.WriteByte(' ')
|
||||
|
||||
if len(m.Detour) > 0 {
|
||||
builder.WriteByte('[')
|
||||
builder.WriteString(" [")
|
||||
builder.WriteString(m.Detour)
|
||||
builder.WriteString("] ")
|
||||
builder.WriteByte(']')
|
||||
}
|
||||
|
||||
if reason := serial.ToString(m.Reason); len(reason) > 0 {
|
||||
builder.WriteString(" ")
|
||||
builder.WriteString(reason)
|
||||
}
|
||||
builder.WriteString(serial.ToString(m.Reason))
|
||||
|
||||
if len(m.Email) > 0 {
|
||||
builder.WriteString("email:")
|
||||
builder.WriteString(" email: ")
|
||||
builder.WriteString(m.Email)
|
||||
builder.WriteByte(' ')
|
||||
}
|
||||
|
||||
return builder.String()
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,7 @@ import (
|
||||
// ToString serialize an arbitrary value into string.
|
||||
func ToString(v interface{}) string {
|
||||
if v == nil {
|
||||
return " "
|
||||
return ""
|
||||
}
|
||||
|
||||
switch value := v.(type) {
|
||||
|
Loading…
Reference in New Issue
Block a user