1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2026-01-04 08:15:21 -05:00

merge log into common log

This commit is contained in:
Darien Raymond
2017-12-19 21:28:12 +01:00
parent 054ceb865d
commit f4c35db968
45 changed files with 297 additions and 406 deletions

View File

@@ -6,7 +6,6 @@ import (
"time"
"v2ray.com/core/app"
"v2ray.com/core/app/log"
"v2ray.com/core/app/proxyman"
"v2ray.com/core/app/proxyman/mux"
"v2ray.com/core/common/buf"
@@ -77,14 +76,14 @@ func (h *Handler) Dispatch(ctx context.Context, outboundRay ray.OutboundRay) {
if h.mux != nil {
err := h.mux.Dispatch(ctx, outboundRay)
if err != nil {
log.Trace(newError("failed to process outbound traffic").Base(err))
newError("failed to process outbound traffic").Base(err).WriteToLog()
outboundRay.OutboundOutput().CloseError()
}
} else {
err := h.proxy.Process(ctx, outboundRay, h)
// Ensure outbound ray is properly closed.
if err != nil && errors.Cause(err) != io.EOF {
log.Trace(newError("failed to process outbound traffic").Base(err))
newError("failed to process outbound traffic").Base(err).WriteToLog()
outboundRay.OutboundOutput().CloseError()
} else {
outboundRay.OutboundOutput().Close()
@@ -100,14 +99,14 @@ func (h *Handler) Dial(ctx context.Context, dest net.Destination) (internet.Conn
tag := h.senderSettings.ProxySettings.Tag
handler := h.outboundManager.GetHandler(tag)
if handler != nil {
log.Trace(newError("proxying to ", tag).AtDebug())
newError("proxying to ", tag).AtDebug().WriteToLog()
ctx = proxy.ContextWithTarget(ctx, dest)
stream := ray.NewRay(ctx)
go handler.Dispatch(ctx, stream)
return NewConnection(stream), nil
}
log.Trace(newError("failed to get outbound handler with tag: ", tag).AtWarning())
newError("failed to get outbound handler with tag: ", tag).AtWarning().WriteToLog()
}
if h.senderSettings.Via != nil {