access log add detour tag

pull/2531/head
fcying 6 years ago committed by Nicholas Wang
parent 534bb31ef1
commit 9682a3df55
No known key found for this signature in database
GPG Key ID: F20CA399C9BD9100

@ -15,6 +15,7 @@ import (
"v2ray.com/core/common/buf"
"v2ray.com/core/common/log"
"v2ray.com/core/common/net"
"v2ray.com/core/common/log"
"v2ray.com/core/common/protocol"
"v2ray.com/core/common/session"
"v2ray.com/core/features/outbound"
@ -288,10 +289,9 @@ func (d *DefaultDispatcher) routedDispatch(ctx context.Context, link *transport.
return
}
if accessMessage := log.AccessMessageFromContext(ctx); accessMessage != nil {
if tag := handler.Tag(); tag != "" {
accessMessage.Detour = tag
}
accessMessage := log.AccessMessageFromContext(ctx)
if accessMessage != nil {
accessMessage.Detour = "[" + handler.Tag() + "]"
log.Record(accessMessage)
}

@ -3,6 +3,7 @@ package log
import (
"context"
"strings"
"context"
"v2ray.com/core/common/serial"
)
@ -25,8 +26,7 @@ type AccessMessage struct {
To interface{}
Status AccessStatus
Reason interface{}
Email string
Detour string
Detour interface{}
}
func (m *AccessMessage) String() string {
@ -37,11 +37,8 @@ func (m *AccessMessage) String() string {
builder.WriteByte(' ')
builder.WriteString(serial.ToString(m.To))
builder.WriteByte(' ')
if len(m.Detour) > 0 {
builder.WriteByte('[')
builder.WriteString(m.Detour)
builder.WriteString("] ")
}
builder.WriteString(serial.ToString(m.Detour))
builder.WriteByte(' ')
builder.WriteString(serial.ToString(m.Reason))
if len(m.Email) > 0 {

Loading…
Cancel
Save