From 881dbdb81b5166266fbe6fb4f4a5b2ddf6f5705b Mon Sep 17 00:00:00 2001 From: a1012112796 <1012112796@qq.com> Date: Wed, 8 Mar 2023 14:46:39 +0800 Subject: [PATCH] make log level configable (#19) relatd: https://gitea.com/gitea/act_runner/pulls/39 Reviewed-on: https://gitea.com/gitea/act/pulls/19 Reviewed-by: Jason Song Reviewed-by: Lunny Xiao Co-authored-by: a1012112796 <1012112796@qq.com> Co-committed-by: a1012112796 <1012112796@qq.com> --- pkg/runner/logger.go | 6 +++++- pkg/runner/runner.go | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/pkg/runner/logger.go b/pkg/runner/logger.go index 7b97927..f3cebce 100644 --- a/pkg/runner/logger.go +++ b/pkg/runner/logger.go @@ -84,7 +84,11 @@ func WithJobLogger(ctx context.Context, jobID string, jobName string, config *Co } logger.SetFormatter(formatter) logger.SetOutput(os.Stdout) - logger.SetLevel(logrus.TraceLevel) // to be aware of steps + if config.JobLoggerLevel != nil { + logger.SetLevel(*config.JobLoggerLevel) + } else { + logger.SetLevel(logrus.TraceLevel) + } rtn := logger.WithFields(logrus.Fields{ "job": jobName, "jobID": jobID, diff --git a/pkg/runner/runner.go b/pkg/runner/runner.go index 65dde5e..5aa1aae 100644 --- a/pkg/runner/runner.go +++ b/pkg/runner/runner.go @@ -59,6 +59,7 @@ type Config struct { ContainerNetworkMode string // the network mode of job containers DefaultActionInstance string // the default actions web site PlatformPicker func(labels []string) string // platform picker, it will take precedence over Platforms if isn't nil + JobLoggerLevel *log.Level // the level of job logger } type runnerImpl struct {