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 <i@wolfogre.com> Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: a1012112796 <1012112796@qq.com> Co-committed-by: a1012112796 <1012112796@qq.com>
This commit is contained in:
parent
1252e551b8
commit
881dbdb81b
2 changed files with 6 additions and 1 deletions
|
@ -84,7 +84,11 @@ func WithJobLogger(ctx context.Context, jobID string, jobName string, config *Co
|
||||||
}
|
}
|
||||||
logger.SetFormatter(formatter)
|
logger.SetFormatter(formatter)
|
||||||
logger.SetOutput(os.Stdout)
|
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{
|
rtn := logger.WithFields(logrus.Fields{
|
||||||
"job": jobName,
|
"job": jobName,
|
||||||
"jobID": jobID,
|
"jobID": jobID,
|
||||||
|
|
|
@ -59,6 +59,7 @@ type Config struct {
|
||||||
ContainerNetworkMode string // the network mode of job containers
|
ContainerNetworkMode string // the network mode of job containers
|
||||||
DefaultActionInstance string // the default actions web site
|
DefaultActionInstance string // the default actions web site
|
||||||
PlatformPicker func(labels []string) string // platform picker, it will take precedence over Platforms if isn't nil
|
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 {
|
type runnerImpl struct {
|
||||||
|
|
Loading…
Reference in a new issue