mirror of https://github.com/gofiber/fiber.git
refactor for repeated code
parent
c09f9a675f
commit
f25c667a8a
56
app.go
56
app.go
|
@ -894,47 +894,29 @@ func (app *App) startupMessage(addr string, tls bool, pids string) {
|
|||
procs = "1"
|
||||
}
|
||||
|
||||
var mainLogo string
|
||||
mainLogo := cBlack+
|
||||
" ┌───────────────────────────────────────────────────┐\n"+
|
||||
" │ "+centerValue(" Fiber v"+Version, 49)+" │\n"
|
||||
|
||||
if host == "0.0.0.0" {
|
||||
const logo string = "%s" +
|
||||
" ┌───────────────────────────────────────────────────┐\n" +
|
||||
" │ %s │\n" +
|
||||
" │ %s │\n" +
|
||||
" │ %s │\n" +
|
||||
" │ │\n" +
|
||||
" │ Handlers %s Processes %s │\n" +
|
||||
" │ Prefork .%s PID ....%s │\n" +
|
||||
" └───────────────────────────────────────────────────┘" +
|
||||
"%s"
|
||||
mainLogo = fmt.Sprintf(logo,
|
||||
cBlack,
|
||||
centerValue(" Fiber v"+Version, 49),
|
||||
center(fmt.Sprintf("%s://127.0.0.1:%s", scheme, port), 49),
|
||||
center(fmt.Sprintf("bound %s://%s:%s", scheme, host, port), 49),
|
||||
value(strconv.Itoa(app.handlerCount), 14), value(procs, 12),
|
||||
value(isPrefork, 14), value(strconv.Itoa(os.Getpid()), 14),
|
||||
cReset,
|
||||
)
|
||||
mainLogo +=
|
||||
" │ "+center(fmt.Sprintf("%s://127.0.0.1:%s", scheme, port), 49)+ " │\n" +
|
||||
" │ "+center(fmt.Sprintf("bound %s://0.0.0.0:%s", scheme, port), 49)+ " │\n"
|
||||
} else {
|
||||
const logo string = "%s" +
|
||||
" ┌───────────────────────────────────────────────────┐\n" +
|
||||
" │ %s │\n" +
|
||||
" │ %s │\n" +
|
||||
" │ │\n" +
|
||||
" │ Handlers %s Processes %s │\n" +
|
||||
" │ Prefork .%s PID ....%s │\n" +
|
||||
" └───────────────────────────────────────────────────┘" +
|
||||
"%s"
|
||||
mainLogo = fmt.Sprintf(logo,
|
||||
cBlack,
|
||||
centerValue(" Fiber v"+Version, 49),
|
||||
center(fmt.Sprintf("%s://%s:%s", scheme, host, port), 49),
|
||||
value(strconv.Itoa(app.handlerCount), 14), value(procs, 12),
|
||||
value(isPrefork, 14), value(strconv.Itoa(os.Getpid()), 14),
|
||||
cReset,
|
||||
)
|
||||
mainLogo +=
|
||||
" │ "+center(fmt.Sprintf("%s://%s:%s", scheme, host, port), 49)+ " │\n"
|
||||
}
|
||||
|
||||
mainLogo += fmt.Sprintf(
|
||||
" │ │\n"+
|
||||
" │ Handlers %s Processes %s │\n"+
|
||||
" │ Prefork .%s PID ....%s │\n"+
|
||||
" └───────────────────────────────────────────────────┘"+
|
||||
cReset,
|
||||
value(strconv.Itoa(app.handlerCount), 14), value(procs, 12),
|
||||
value(isPrefork, 14), value(strconv.Itoa(os.Getpid()), 14),
|
||||
)
|
||||
|
||||
var childPidsLogo string
|
||||
if app.config.Prefork {
|
||||
var childPidsTemplate string
|
||||
|
|
Loading…
Reference in New Issue