# `gno.land/p/nym-moultest123/debug` A debug panel for realms: collect log lines while `Render` runs, then append them as a collapsible section, but only when the reader asks for it with `?debug=1`. ```go func Render(path string) string { var d debug.Debug d.Log("loaded " + ufmt.Sprintf("%d", n) + " items") out := renderPage() out += d.Render(path) // empty unless ?debug=1 return out } ``` Without the query parameter the panel renders nothing, so the same code is safe to leave in a deployed realm: there is no debug build and no flag to flip. ## API ```go func (d *Debug) Log(line string) // append one line func (d Debug) Render(path string) string func Render(path string) string // metadata only, no logs func IsEnabled(path string) bool // is ?debug=1 set func ToggleURL(path string) string // same path with ?debug=1 added or removed ``` The struct is two fields, `Logs []string` and `HideMetadata bool`, so the zero value already works and metadata is on unless you turn it off. The metadata table reports the current realm's pkgpath and address, the previous realm's pkgpath and address, the block height, and `time.Now()`. Those six are what you need first when a realm behaves differently on chain than it did in a test, and the previous-realm pair in particular is what a cross-realm permission bug looks like. `ToggleURL` is there so the page can render its own "debug" link: ```go out += md.Link("debug", debug.ToggleURL(path)) ``` Logs cost nothing on chain: they are built during a `Render` query and thrown away with it. Do not call `Log` from a transaction path expecting persistence. --- Part of **[moul/gno-contracts](https://github.com/moul/gno-contracts)** — moul's versioned gno.land contracts. See the repository for the full catalog, build/test tooling, and usage. **Dependency graph:** ![gno.land/p/nym-moultest123/debug/v0 dependency graph](https://raw.githubusercontent.com/moul/gno-contracts/main/_assets/gno.land/p/nym-moultest123/debug/v0/deps.png) > ⚠️ **Disclaimer:** provided as-is, without warranty; not security-audited. Full disclaimer: [DISCLAIMER](https://github.com/moul/gno-contracts/blob/main/DISCLAIMER.md).