From 0d60a9e7190a16e5cbfda9492ccf0c04c02bb7b8 Mon Sep 17 00:00:00 2001 From: vcptr <51714622+vcptr@users.noreply.github.com> Date: Thu, 31 Oct 2019 17:24:25 +0800 Subject: [PATCH] logger module start firstly --- infra/conf/v2ray.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/infra/conf/v2ray.go b/infra/conf/v2ray.go index 3d3c0d112..01f74b4ff 100644 --- a/infra/conf/v2ray.go +++ b/infra/conf/v2ray.go @@ -341,11 +341,15 @@ func (c *Config) Build() (*core.Config, error) { config.App = append(config.App, serial.ToTypedMessage(statsConf)) } + var logConfMsg *serial.TypedMessage if c.LogConfig != nil { - config.App = append(config.App, serial.ToTypedMessage(c.LogConfig.Build())) + logConfMsg = serial.ToTypedMessage(c.LogConfig.Build()) } 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 { routerConfig, err := c.RouterConfig.Build()