Browse Source

一次结束的时候需要先把日志文件流关闭

Signed-off-by: allan716 <[email protected]>
allan716 3 years ago
parent
commit
2bdcedba37
1 changed files with 4 additions and 0 deletions
  1. 4 0
      internal/pkg/log_helper/log_hub.go

+ 4 - 0
internal/pkg/log_helper/log_hub.go

@@ -53,6 +53,10 @@ func (lh *LoggerHub) Fire(entry *logrus.Entry) error {
 	} else if entry.Message == OnceSubsScanEnd {
 		// “一次”扫描的结束标志位
 		lh.onceStart = false
+		if onceLoggerFile != nil {
+			_ = onceLoggerFile.Close()
+			onceLoggerFile = nil
+		}
 		return nil
 	}