Allow plugins to set a log formatter when TTY isn't allocated (#385)
This commit is contained in:
parent
70fb830dca
commit
9cd6050812
1 changed files with 5 additions and 3 deletions
|
|
@ -49,10 +49,12 @@ func ConfigStdioLogrus(p SshPiperPlugin, formatter logrus.Formatter, logger *log
|
|||
lv, _ := logrus.ParseLevel(level)
|
||||
logger.SetLevel(lv)
|
||||
|
||||
if formatter != nil {
|
||||
logger.SetFormatter(formatter)
|
||||
}
|
||||
|
||||
if tty {
|
||||
if formatter != nil {
|
||||
logger.SetFormatter(formatter)
|
||||
} else {
|
||||
if formatter == nil {
|
||||
logger.SetFormatter(&logrus.TextFormatter{ForceColors: true})
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue