Add HTTP /v1 MVC, TCP send path, groups with server-side member-avatar collage, object-storage upload, and friends/favorites around the architecture-v3 layout. Co-authored-by: Cursor <cursoragent@cursor.com>
21 lines
437 B
Go
21 lines
437 B
Go
package logger
|
|
|
|
import (
|
|
"regexp"
|
|
)
|
|
|
|
const MaxBody = 4096
|
|
|
|
var secretJSON = regexp.MustCompile(`(?i)("(token|access_token|refresh_token|authorization|password|verify_code|upload_url|download_url|secret_key|access_key)"\s*:\s*")[^"]*`)
|
|
|
|
func ClipBody(b []byte) string {
|
|
if len(b) == 0 {
|
|
return ""
|
|
}
|
|
s := secretJSON.ReplaceAllString(string(b), `${1}***`)
|
|
if len(s) > MaxBody {
|
|
return s[:MaxBody] + "...<truncated>"
|
|
}
|
|
return s
|
|
}
|