refactor: around CheckHTTPHealth (#1139)

This commit is contained in:
Kota Kanbe
2021-01-20 07:41:29 +09:00
committed by GitHub
parent 59dc0059bc
commit 88899f0e89
22 changed files with 158 additions and 298 deletions

View File

@@ -26,10 +26,11 @@ func init() {
}
// NewCustomLogger creates logrus
func NewCustomLogger(c config.ServerInfo) *logrus.Entry {
func NewCustomLogger(server config.ServerInfo) *logrus.Entry {
log := logrus.New()
log.Formatter = &formatter.TextFormatter{MsgAnsiColor: c.LogMsgAnsiColor}
log.Formatter = &formatter.TextFormatter{MsgAnsiColor: server.LogMsgAnsiColor}
log.Level = logrus.InfoLevel
//TODO passed by arg
if config.Conf.Debug {
log.Level = logrus.DebugLevel
}
@@ -64,8 +65,8 @@ func NewCustomLogger(c config.ServerInfo) *logrus.Entry {
}
whereami := "localhost"
if 0 < len(c.ServerName) {
whereami = c.GetServerName()
if 0 < len(server.ServerName) {
whereami = server.GetServerName()
}
if _, err := os.Stat(logDir); err == nil {

View File

@@ -127,7 +127,7 @@ func ProxyEnv() string {
// PrependProxyEnv prepends proxy environment variable
func PrependProxyEnv(cmd string) string {
if len(config.Conf.HTTPProxy) == 0 {
if config.Conf.HTTPProxy == "" {
return cmd
}
return fmt.Sprintf("%s %s", ProxyEnv(), cmd)