refactor(i18n): shorten handler names in state snapshots
All checks were successful
Security Scan / security (push) Successful in 20s
Test / test (push) Successful in 2m12s

Co-Authored-By: Virgil <virgil@lethean.io>
This commit is contained in:
Virgil 2026-04-02 14:16:49 +00:00
parent 4608de8def
commit 0e01e9f894

View file

@ -1,6 +1,8 @@
package i18n
import (
"strings"
"dappco.re/go/core"
)
@ -82,7 +84,7 @@ func (s ServiceState) String() string {
names = append(names, "<nil>")
continue
}
names = append(names, core.Sprintf("%T", handler))
names = append(names, shortHandlerTypeName(handler))
}
handlers = "[" + core.Join(", ", names...) + "]"
}
@ -104,6 +106,14 @@ func (s ServiceState) String() string {
)
}
func shortHandlerTypeName(handler KeyHandler) string {
name := core.Sprintf("%T", handler)
if idx := strings.LastIndex(name, "."); idx >= 0 {
name = name[idx+1:]
}
return strings.TrimPrefix(name, "*")
}
func (s *Service) State() ServiceState {
if s == nil {
return defaultServiceStateSnapshot()