2026-02-16 19:51:27 +00:00
|
|
|
package i18n
|
|
|
|
|
|
2026-04-02 12:59:09 +00:00
|
|
|
import "dappco.re/go/core"
|
|
|
|
|
|
2026-02-16 19:51:27 +00:00
|
|
|
// SetDebug enables or disables debug mode on the default service.
|
|
|
|
|
func SetDebug(enabled bool) {
|
2026-04-02 09:52:50 +00:00
|
|
|
withDefaultService(func(svc *Service) { svc.SetDebug(enabled) })
|
2026-02-16 19:51:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (s *Service) SetDebug(enabled bool) {
|
2026-04-02 14:02:13 +00:00
|
|
|
if s == nil {
|
|
|
|
|
return
|
|
|
|
|
}
|
2026-02-16 19:51:27 +00:00
|
|
|
s.mu.Lock()
|
|
|
|
|
defer s.mu.Unlock()
|
|
|
|
|
s.debug = enabled
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (s *Service) Debug() bool {
|
2026-04-02 14:02:13 +00:00
|
|
|
if s == nil {
|
|
|
|
|
return false
|
|
|
|
|
}
|
2026-02-16 19:51:27 +00:00
|
|
|
s.mu.RLock()
|
|
|
|
|
defer s.mu.RUnlock()
|
|
|
|
|
return s.debug
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func debugFormat(key, text string) string {
|
2026-04-02 12:59:09 +00:00
|
|
|
return core.Sprintf("[%s] %s", key, text)
|
2026-02-16 19:51:27 +00:00
|
|
|
}
|