format code

This commit is contained in:
Ming Deng
2020-12-14 12:22:44 +08:00
parent 181a5b6ef6
commit d4da82ef77
51 changed files with 174 additions and 183 deletions

View File

@@ -1,17 +1,15 @@
## logs
logs is a Go logs manager. It can use many logs adapters. The repo is inspired by `database/sql` .
logs is a Go logs manager. It can use many logs adapters. The repo is inspired by `database/sql` .
## How to install?
go get github.com/beego/beego/v2/logs
## What adapters are supported?
As of now this logs support console, file,smtp and conn.
## How to use it?
First you must import it

View File

@@ -58,7 +58,7 @@ func TestConsoleAsync(t *testing.T) {
log := NewLogger(100)
log.SetLogger("console")
log.Async()
//log.Close()
// log.Close()
testConsoleCalls(log)
for len(log.msgChan) != 0 {
time.Sleep(1 * time.Millisecond)

View File

@@ -164,7 +164,7 @@ func TestFileDailyRotate_05(t *testing.T) {
testFileDailyRotate(t, fn1, fn2)
os.Remove(fn)
}
func TestFileDailyRotate_06(t *testing.T) { //test file mode
func TestFileDailyRotate_06(t *testing.T) { // test file mode
log := NewLogger(10000)
log.SetLogger("file", `{"filename":"test3.log","maxlines":4}`)
log.Debug("debug")
@@ -237,7 +237,7 @@ func TestFileHourlyRotate_05(t *testing.T) {
os.Remove(fn)
}
func TestFileHourlyRotate_06(t *testing.T) { //test file mode
func TestFileHourlyRotate_06(t *testing.T) { // test file mode
log := NewLogger(10000)
log.SetLogger("file", `{"filename":"test3.log", "hourly":true, "maxlines":4}`)
log.Debug("debug")

View File

@@ -60,7 +60,7 @@ func formatTimeHeader(when time.Time) ([]byte, int, int) {
y, mo, d := when.Date()
h, mi, s := when.Clock()
ns := when.Nanosecond() / 1000000
//len("2006/01/02 15:04:05.123 ")==24
// len("2006/01/02 15:04:05.123 ")==24
var buf [24]byte
buf[0] = y1[y/1000%10]
@@ -126,12 +126,12 @@ func initColor() {
cyan = w32Cyan
}
colorMap = map[string]string{
//by color
// by color
"green": green,
"white": white,
"yellow": yellow,
"red": red,
//by method
// by method
"GET": blue,
"POST": cyan,
"PUT": yellow,