mirror of https://github.com/v2ray/v2ray-core
commit
c94f5f66a6
|
@ -29,6 +29,13 @@ func New(ctx context.Context, config *Config) (*Instance, error) {
|
||||||
}
|
}
|
||||||
log.RegisterHandler(g)
|
log.RegisterHandler(g)
|
||||||
|
|
||||||
|
// start logger instantly on inited
|
||||||
|
// other modules would log during init
|
||||||
|
if err := g.startInternal(); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
newError("Logger started").AtDebug().WriteToLog()
|
||||||
return g, nil
|
return g, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,13 +88,7 @@ func (g *Instance) startInternal() error {
|
||||||
|
|
||||||
// Start implements common.Runnable.Start().
|
// Start implements common.Runnable.Start().
|
||||||
func (g *Instance) Start() error {
|
func (g *Instance) Start() error {
|
||||||
if err := g.startInternal(); err != nil {
|
return g.startInternal()
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
newError("Logger started").AtDebug().WriteToLog()
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle implements log.Handler.
|
// Handle implements log.Handler.
|
||||||
|
|
|
@ -341,11 +341,15 @@ func (c *Config) Build() (*core.Config, error) {
|
||||||
config.App = append(config.App, serial.ToTypedMessage(statsConf))
|
config.App = append(config.App, serial.ToTypedMessage(statsConf))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var logConfMsg *serial.TypedMessage
|
||||||
if c.LogConfig != nil {
|
if c.LogConfig != nil {
|
||||||
config.App = append(config.App, serial.ToTypedMessage(c.LogConfig.Build()))
|
logConfMsg = serial.ToTypedMessage(c.LogConfig.Build())
|
||||||
} else {
|
} else {
|
||||||
config.App = append(config.App, serial.ToTypedMessage(DefaultLogConfig()))
|
logConfMsg = serial.ToTypedMessage(DefaultLogConfig())
|
||||||
}
|
}
|
||||||
|
// let logger module be the first App to start,
|
||||||
|
// so that other modules could print log during initiating
|
||||||
|
config.App = append([]*serial.TypedMessage{logConfMsg}, config.App...)
|
||||||
|
|
||||||
if c.RouterConfig != nil {
|
if c.RouterConfig != nil {
|
||||||
routerConfig, err := c.RouterConfig.Build()
|
routerConfig, err := c.RouterConfig.Build()
|
||||||
|
|
Loading…
Reference in New Issue