feat: add logger hook for standalone job logger

This commit is contained in:
fuxiaohei
2022-07-29 15:43:42 +08:00
committed by Jason Song
parent a9298d936c
commit 0fa1fe0310
2 changed files with 24 additions and 0 deletions

View File

@@ -79,6 +79,9 @@ func WithJobLogger(ctx context.Context, jobID string, jobName string, config *Co
ctx = WithMasks(ctx, masks)
logger := logrus.New()
if hook := common.LoggerHook(ctx); hook != nil {
logger.AddHook(hook)
}
logger.SetFormatter(formatter)
logger.SetOutput(os.Stdout)
logger.SetLevel(logrus.GetLevel())