1
0
mirror of https://github.com/astaxie/beego.git synced 2024-11-22 09:30:56 +00:00

better comment for color map

This commit is contained in:
JessonChan 2019-03-08 12:10:57 +08:00
parent 4a5e108527
commit 8432a1c758

View File

@ -161,10 +161,12 @@ func initColor() {
cyan = w32Cyan cyan = w32Cyan
} }
colorMap = map[string]string{ colorMap = map[string]string{
"green": green, //by color
"white": white, "green": green,
"yellow": yellow, "white": white,
"red": red, "yellow": yellow,
"red": red,
//by method
"GET": blue, "GET": blue,
"POST": cyan, "POST": cyan,
"PUT": yellow, "PUT": yellow,
@ -195,13 +197,6 @@ func ColorByStatus(code int) string {
} }
// ColorByMethod return color by http code // ColorByMethod return color by http code
// GET return Blue
// POST return Cyan
// PUT return Yellow
// DELETE return Red
// PATCH return Green
// HEAD return Magenta
// OPTIONS return WHITE
func ColorByMethod(method string) string { func ColorByMethod(method string) string {
once.Do(initColor) once.Do(initColor)
if c := colorMap[method]; c != "" { if c := colorMap[method]; c != "" {