mirror of https://github.com/v2ray/v2ray-core
format log
parent
d6086e0e9b
commit
6c441e2a5f
|
@ -1,6 +1,7 @@
|
||||||
package log
|
package log
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"errors"
|
||||||
"v2ray.com/core/common/log/internal"
|
"v2ray.com/core/common/log/internal"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -38,8 +39,7 @@ func SetLogLevel(level LogLevel) {
|
||||||
func InitErrorLogger(file string) error {
|
func InitErrorLogger(file string) error {
|
||||||
logger, err := internal.NewFileLogWriter(file)
|
logger, err := internal.NewFileLogWriter(file)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
Error("Failed to create error logger on file (", file, "): ", err)
|
return errors.New("Log:Failed to create error logger on file (" + file + "): " + err.Error())
|
||||||
return err
|
|
||||||
}
|
}
|
||||||
streamLoggerInstance = logger
|
streamLoggerInstance = logger
|
||||||
return nil
|
return nil
|
||||||
|
|
10
v2ray.go
10
v2ray.go
|
@ -85,19 +85,19 @@ func NewPoint(pConfig *Config) (*Point, error) {
|
||||||
case AllocationStrategy_Always:
|
case AllocationStrategy_Always:
|
||||||
dh, err := NewInboundDetourHandlerAlways(vpoint.space, inbound)
|
dh, err := NewInboundDetourHandlerAlways(vpoint.space, inbound)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("Point: Failed to create detour handler: ", err)
|
log.Error("V2Ray: Failed to create detour handler: ", err)
|
||||||
return nil, common.ErrBadConfiguration
|
return nil, common.ErrBadConfiguration
|
||||||
}
|
}
|
||||||
inboundHandler = dh
|
inboundHandler = dh
|
||||||
case AllocationStrategy_Random:
|
case AllocationStrategy_Random:
|
||||||
dh, err := NewInboundDetourHandlerDynamic(vpoint.space, inbound)
|
dh, err := NewInboundDetourHandlerDynamic(vpoint.space, inbound)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("Point: Failed to create detour handler: ", err)
|
log.Error("V2Ray: Failed to create detour handler: ", err)
|
||||||
return nil, common.ErrBadConfiguration
|
return nil, common.ErrBadConfiguration
|
||||||
}
|
}
|
||||||
inboundHandler = dh
|
inboundHandler = dh
|
||||||
default:
|
default:
|
||||||
log.Error("Point: Unknown allocation strategy: ", allocConfig.Type)
|
log.Error("V2Ray: Unknown allocation strategy: ", allocConfig.Type)
|
||||||
return nil, common.ErrBadConfiguration
|
return nil, common.ErrBadConfiguration
|
||||||
}
|
}
|
||||||
vpoint.inboundHandlers = append(vpoint.inboundHandlers, inboundHandler)
|
vpoint.inboundHandlers = append(vpoint.inboundHandlers, inboundHandler)
|
||||||
|
@ -121,7 +121,7 @@ func NewPoint(pConfig *Config) (*Point, error) {
|
||||||
ProxySettings: outbound.ProxySettings,
|
ProxySettings: outbound.ProxySettings,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("Point: Failed to create detour outbound connection handler: ", err)
|
log.Error("V2Ray: Failed to create detour outbound connection handler: ", err)
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if idx == 0 {
|
if idx == 0 {
|
||||||
|
@ -165,7 +165,7 @@ func (this *Point) Start() error {
|
||||||
func (this *Point) GetHandler(tag string) (proxy.InboundHandler, int) {
|
func (this *Point) GetHandler(tag string) (proxy.InboundHandler, int) {
|
||||||
handler, found := this.taggedInboundHandlers[tag]
|
handler, found := this.taggedInboundHandlers[tag]
|
||||||
if !found {
|
if !found {
|
||||||
log.Warning("Point: Unable to find an inbound handler with tag: ", tag)
|
log.Warning("V2Ray: Unable to find an inbound handler with tag: ", tag)
|
||||||
return nil, 0
|
return nil, 0
|
||||||
}
|
}
|
||||||
return handler.GetConnectionHandler()
|
return handler.GetConnectionHandler()
|
||||||
|
|
Loading…
Reference in New Issue