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:
Kevin Wan
2022-05-07 23:22:39 +08:00
committed by GitHub
parent 5383e29ce6
commit 69c2bad410
13 changed files with 261 additions and 26 deletions

View File

@@ -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,