feat: 日志增强

This commit is contained in:
tbphp
2025-07-14 00:18:15 +08:00
parent 2740254cf1
commit 807b766e79
6 changed files with 57 additions and 15 deletions

View File

@@ -10,3 +10,11 @@ func MaskAPIKey(key string) string {
}
return fmt.Sprintf("%s****%s", key[:4], key[length-4:])
}
// TruncateString shortens a string to a maximum length.
func TruncateString(s string, maxLength int) string {
if len(s) > maxLength {
return s[:maxLength]
}
return s
}