1
0
mirror of https://github.com/gofiber/fiber.git synced 2025-02-22 20:43:46 +00:00

Print addr when listening

This commit is contained in:
Fenny 2020-04-26 05:57:18 +02:00
parent a63c29fe21
commit 683a33b143
2 changed files with 8 additions and 2 deletions

6
app.go
View File

@ -337,7 +337,8 @@ func (app *App) Serve(ln net.Listener, tlsconfig ...*tls.Config) error {
ln = tls.NewListener(ln, tlsconfig[0])
}
// Print listening message
fmt.Printf("Fiber v%s listening on %s\n", Version, ln.Addr().String())
fmt.Printf(" _______ __\n ____ / ____(_) /_ ___ _____\n_____ / /_ / / __ \\/ _ \\/ ___/\n __ / __/ / / /_/ / __/ /\n /_/ /_/_.___/\\___/_/ v%s\n", Version)
fmt.Printf("Started listening on %s\n", ln.Addr().String())
return app.server.Serve(ln)
}
@ -376,7 +377,8 @@ func (app *App) Listen(address interface{}, tlsconfig ...*tls.Config) error {
}
// Print listening message
if !isChild() {
fmt.Printf("Fiber v%s listening on %s\n", Version, addr)
fmt.Printf(" _______ __\n ____ / ____(_) /_ ___ _____\n_____ / /_ / / __ \\/ _ \\/ ___/\n __ / __/ / / /_/ / __/ /\n /_/ /_/_.___/\\___/_/ v%s\n", Version)
fmt.Printf("Started listening on %s\n", ln.Addr().String())
}
return app.server.Serve(ln)
}

View File

@ -161,6 +161,7 @@ var statusMessages = map[int]string{
100: "Continue",
101: "Switching Protocols",
102: "Processing",
103: "Early Hints",
200: "OK",
201: "Created",
202: "Accepted",
@ -199,6 +200,7 @@ var statusMessages = map[int]string{
416: "Requested Range Not Satisfiable",
417: "Expectation Failed",
418: "I'm a teapot",
421: "Misdirected Request",
422: "Unprocessable Entity",
423: "Locked",
424: "Failed Dependency",
@ -635,6 +637,7 @@ const (
StatusContinue = 100 // RFC 7231, 6.2.1
StatusSwitchingProtocols = 101 // RFC 7231, 6.2.2
StatusProcessing = 102 // RFC 2518, 10.1
StatusEarlyHints = 103 // RFC 8297
StatusOK = 200 // RFC 7231, 6.3.1
StatusCreated = 201 // RFC 7231, 6.3.2
@ -676,6 +679,7 @@ const (
StatusRequestedRangeNotSatisfiable = 416 // RFC 7233, 4.4
StatusExpectationFailed = 417 // RFC 7231, 6.5.14
StatusTeapot = 418 // RFC 7168, 2.3.3
StatusMisdirectedRequest = 421 // RFC 7540, 9.1.2
StatusUnprocessableEntity = 422 // RFC 4918, 11.2
StatusLocked = 423 // RFC 4918, 11.3
StatusFailedDependency = 424 // RFC 4918, 11.4