24 lines
484 B
Go
24 lines
484 B
Go
package i18n
|
|
|
|
import "dappco.re/go/core"
|
|
|
|
// SetDebug enables or disables debug mode on the default service.
|
|
func SetDebug(enabled bool) {
|
|
withDefaultService(func(svc *Service) { svc.SetDebug(enabled) })
|
|
}
|
|
|
|
func (s *Service) SetDebug(enabled bool) {
|
|
s.mu.Lock()
|
|
defer s.mu.Unlock()
|
|
s.debug = enabled
|
|
}
|
|
|
|
func (s *Service) Debug() bool {
|
|
s.mu.RLock()
|
|
defer s.mu.RUnlock()
|
|
return s.debug
|
|
}
|
|
|
|
func debugFormat(key, text string) string {
|
|
return core.Sprintf("[%s] %s", key, text)
|
|
}
|