feat: logx with color (#1872)
* feat: logx with color * chore: update logs * fix test error * chore: change colors of http codes * chore: add comments * chore: use faith/color instead of ascii code color * chore: update colors * chore: update colors * chore: fix duplicated slowcall text * chore: remove slowcall colors
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"crypto/tls"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"testing"
|
||||
@@ -11,11 +12,16 @@ import (
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/zeromicro/go-zero/core/conf"
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"github.com/zeromicro/go-zero/rest/router"
|
||||
)
|
||||
|
||||
func TestNewServer(t *testing.T) {
|
||||
writer := logx.Reset()
|
||||
defer logx.SetWriter(writer)
|
||||
logx.SetWriter(logx.NewWriter(ioutil.Discard))
|
||||
|
||||
const configYaml = `
|
||||
Name: foo
|
||||
Port: 54321
|
||||
@@ -31,7 +37,6 @@ Port: 54321
|
||||
{
|
||||
c: RestConf{},
|
||||
opts: []RunOption{WithRouter(mockedRouter{}), WithCors()},
|
||||
fail: true,
|
||||
},
|
||||
{
|
||||
c: cnf,
|
||||
|
||||
Reference in New Issue
Block a user