| 12 | } |
| 13 | |
| 14 | func (w watcherDebug) MarshalJSON() ([]byte, error) { |
| 15 | state := w.state.Load() |
| 16 | return strutils.MarshalJSON(map[string]any{ |
| 17 | "name": w.Name(), |
| 18 | "state": map[string]string{ |
| 19 | "status": string(state.status), |
| 20 | "ready": strconv.FormatBool(state.ready), |
| 21 | "err": fmtErr(state.err), |
| 22 | }, |
| 23 | "expires": strutils.FormatTime(w.expires()), |
| 24 | "last_reset": strutils.FormatTime(w.lastReset.Load()), |
| 25 | "config": w.cfg, |
| 26 | }) |
| 27 | } |
| 28 | |
| 29 | func Watchers() iter.Seq2[string, watcherDebug] { |
| 30 | return func(yield func(string, watcherDebug) bool) { |