mirror of https://github.com/gofiber/fiber.git
Use colorable for Windows
parent
0ca00404eb
commit
cb87d9337e
|
@ -20,6 +20,7 @@ import (
|
|||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/mattn/go-colorable"
|
||||
"github.com/valyala/fasthttp"
|
||||
"github.com/valyala/fasthttp/reuseport"
|
||||
)
|
||||
|
@ -260,18 +261,20 @@ func (r *Fiber) Listen(address interface{}, tls ...string) {
|
|||
// Create fasthttp server
|
||||
r.httpServer = r.setupServer()
|
||||
|
||||
out := colorable.NewColorableStdout()
|
||||
|
||||
// Prefork enabled
|
||||
if r.Prefork && runtime.NumCPU() > 1 {
|
||||
if r.Banner && !r.child {
|
||||
cores := fmt.Sprintf("%s\x1b[1;30m %v cores", host, runtime.NumCPU())
|
||||
fmt.Printf(banner, Version, " prefork", "Express on steroids", cores)
|
||||
fmt.Fprintf(out, banner, Version, " prefork", "Express on steroids", cores)
|
||||
}
|
||||
r.prefork(host, tls...)
|
||||
}
|
||||
|
||||
// Prefork disabled
|
||||
if r.Banner {
|
||||
fmt.Printf(banner, Version, "", "Express on steroids", host)
|
||||
fmt.Fprintf(out, banner, Version, "", "Express on steroids", host)
|
||||
}
|
||||
|
||||
ln, err := net.Listen("tcp4", host)
|
||||
|
|
1
go.mod
1
go.mod
|
@ -4,5 +4,6 @@ go 1.11
|
|||
|
||||
require (
|
||||
github.com/json-iterator/go v1.1.9
|
||||
github.com/mattn/go-colorable v0.1.4
|
||||
github.com/valyala/fasthttp v1.9.0
|
||||
)
|
||||
|
|
5
go.sum
5
go.sum
|
@ -7,6 +7,10 @@ github.com/klauspost/compress v1.8.2 h1:Bx0qjetmNjdFXASH02NSAREKpiaDwkO1DRZ3dV2K
|
|||
github.com/klauspost/compress v1.8.2/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A=
|
||||
github.com/klauspost/cpuid v1.2.1 h1:vJi+O/nMdFt0vqm8NZBI6wzALWdA2X+egi0ogNyrC/w=
|
||||
github.com/klauspost/cpuid v1.2.1/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek=
|
||||
github.com/mattn/go-colorable v0.1.4 h1:snbPLB8fVfU9iwbbo30TPtbLRzwWu6aJS6Xh4eaaviA=
|
||||
github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
|
||||
github.com/mattn/go-isatty v0.0.8 h1:HLtExJ+uU2HOZ+wI0Tt5DtUDrx8yhUqDcp7fYERX4CE=
|
||||
github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
|
||||
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 h1:ZqeYNhU3OHLH3mGKHDcjJRFFRrJa6eAM5H+CtDdOsPc=
|
||||
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742 h1:Esafd1046DLDQ0W1YjYsBW+p8U2u7vzgW2SQVmlNazg=
|
||||
|
@ -23,4 +27,5 @@ github.com/valyala/tcplisten v0.0.0-20161114210144-ceec8f93295a/go.mod h1:v3UYOV
|
|||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
|
|
Loading…
Reference in New Issue