feat: implement core backend for team owner management with SQLite, auto-add APIs, and a frontend owner list component.
This commit is contained in:
@@ -119,19 +119,27 @@ func log(level, message, email, module string) {
|
||||
color := ""
|
||||
switch level {
|
||||
case "info":
|
||||
prefix = "INFO"
|
||||
prefix = "INFO "
|
||||
color = colorCyan
|
||||
case "success":
|
||||
prefix = "SUCCESS"
|
||||
color = colorGreen
|
||||
case "error":
|
||||
prefix = "ERROR"
|
||||
prefix = "ERROR "
|
||||
color = colorRed
|
||||
case "warning":
|
||||
prefix = "WARN"
|
||||
prefix = "WARN "
|
||||
color = colorYellow
|
||||
}
|
||||
|
||||
// 模块名固定宽度(8字符)
|
||||
moduleStr := module
|
||||
if len(moduleStr) < 8 {
|
||||
moduleStr = moduleStr + strings.Repeat(" ", 8-len(moduleStr))
|
||||
} else if len(moduleStr) > 8 {
|
||||
moduleStr = moduleStr[:8]
|
||||
}
|
||||
|
||||
// 如果是 Team 相关日志,消息使用 Team 颜色
|
||||
msgColor := colorReset
|
||||
if teamColor != "" {
|
||||
@@ -139,15 +147,20 @@ func log(level, message, email, module string) {
|
||||
}
|
||||
|
||||
if email != "" {
|
||||
fmt.Printf("%s%s%s %s[%s]%s [%s] %s - %s%s%s\n",
|
||||
// 截断长邮箱,保持对齐
|
||||
emailDisplay := email
|
||||
if len(emailDisplay) > 35 {
|
||||
emailDisplay = emailDisplay[:32] + "..."
|
||||
}
|
||||
fmt.Printf("%s%s%s %s[%s]%s [%s] %s%s%s\n",
|
||||
colorGray, timestamp, colorReset,
|
||||
color, prefix, colorReset,
|
||||
module, email, msgColor, message, colorReset)
|
||||
moduleStr, msgColor, message, colorReset)
|
||||
} else {
|
||||
fmt.Printf("%s%s%s %s[%s]%s [%s] %s%s%s\n",
|
||||
colorGray, timestamp, colorReset,
|
||||
color, prefix, colorReset,
|
||||
module, msgColor, message, colorReset)
|
||||
moduleStr, msgColor, message, colorReset)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user