fix reset color format.
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
This commit is contained in:
parent
d94e305e73
commit
1f404e0864
|
@ -151,15 +151,16 @@ func LogRequest(uri string, method string, ip string, contentType string, agent
|
||||||
|
|
||||||
output = string(logJSON)
|
output = string(logJSON)
|
||||||
} else {
|
} else {
|
||||||
var headerColor string
|
var headerColor, resetColor string
|
||||||
|
|
||||||
if isTerm {
|
if isTerm {
|
||||||
headerColor = magenta
|
headerColor = magenta
|
||||||
|
resetColor = reset
|
||||||
}
|
}
|
||||||
|
|
||||||
// format is string
|
// format is string
|
||||||
output = fmt.Sprintf("|%s header %s| %s %s %s %s %s",
|
output = fmt.Sprintf("|%s header %s| %s %s %s %s %s",
|
||||||
headerColor, reset,
|
headerColor, resetColor,
|
||||||
log.Method,
|
log.Method,
|
||||||
log.URI,
|
log.URI,
|
||||||
log.IP,
|
log.IP,
|
||||||
|
@ -213,11 +214,12 @@ func hideToken(token string, markLen int) string {
|
||||||
|
|
||||||
// LogPush record user push request and server response.
|
// LogPush record user push request and server response.
|
||||||
func LogPush(status, token string, req PushNotification, errPush error) {
|
func LogPush(status, token string, req PushNotification, errPush error) {
|
||||||
var plat, platColor, output string
|
var plat, platColor, resetColor, output string
|
||||||
|
|
||||||
if isTerm {
|
if isTerm {
|
||||||
platColor = colorForPlatForm(req.Platform)
|
platColor = colorForPlatForm(req.Platform)
|
||||||
plat = typeForPlatForm(req.Platform)
|
plat = typeForPlatForm(req.Platform)
|
||||||
|
resetColor = reset
|
||||||
}
|
}
|
||||||
|
|
||||||
errMsg := ""
|
errMsg := ""
|
||||||
|
@ -250,8 +252,8 @@ func LogPush(status, token string, req PushNotification, errPush error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
output = fmt.Sprintf("|%s %s %s| %s%s%s [%s] %s",
|
output = fmt.Sprintf("|%s %s %s| %s%s%s [%s] %s",
|
||||||
typeColor, log.Type, reset,
|
typeColor, log.Type, resetColor,
|
||||||
platColor, log.Platform, reset,
|
platColor, log.Platform, resetColor,
|
||||||
log.Token,
|
log.Token,
|
||||||
log.Message,
|
log.Message,
|
||||||
)
|
)
|
||||||
|
@ -261,8 +263,8 @@ func LogPush(status, token string, req PushNotification, errPush error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
output = fmt.Sprintf("|%s %s %s| %s%s%s [%s] | %s | Error Message: %s",
|
output = fmt.Sprintf("|%s %s %s| %s%s%s [%s] | %s | Error Message: %s",
|
||||||
typeColor, log.Type, reset,
|
typeColor, log.Type, resetColor,
|
||||||
platColor, log.Platform, reset,
|
platColor, log.Platform, resetColor,
|
||||||
log.Token,
|
log.Token,
|
||||||
log.Message,
|
log.Message,
|
||||||
log.Error,
|
log.Error,
|
||||||
|
|
Loading…
Reference in New Issue