align log level across plugins
happy lint happy lint
This commit is contained in:
parent
d3ec47f4ec
commit
319824e564
13 changed files with 286 additions and 230 deletions
|
|
@ -2,6 +2,7 @@ package libplugin
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"net"
|
||||
"strconv"
|
||||
|
||||
|
|
@ -40,8 +41,16 @@ func ConfigStdioLogrus(p SshPiperPlugin, logger *logrus.Logger) {
|
|||
if logger == nil {
|
||||
logger = logrus.StandardLogger()
|
||||
}
|
||||
logger.SetOutput(p.GetLoggerOutput())
|
||||
logger.SetFormatter(&logrus.TextFormatter{ForceColors: true})
|
||||
|
||||
p.SetConfigLoggerCallback(func(w io.Writer, level string, tty bool) {
|
||||
logger.SetOutput(w)
|
||||
lv, _ := logrus.ParseLevel(level)
|
||||
logger.SetLevel(lv)
|
||||
|
||||
if tty {
|
||||
logger.SetFormatter(&logrus.TextFormatter{ForceColors: true})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// SplitHostPortForSSH is the modified version of net.SplitHostPort but return port 22 is no port is specified
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue