Search Apps Documentation Source Content File Folder Download Copy Actions Download State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

v2 source pure

Package debug provides utilities for logging and displaying debug information within Gno realms. It supports conditio...

Readme View source

gno.land/p/moul/debug/v1

TODO: describe this package.


Part of 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/moul/debug/v2 dependency graph

⚠️ Disclaimer: provided as-is, without warranty; not security-audited. Full disclaimer: DISCLAIMER.

Overview

Package debug provides utilities for logging and displaying debug information within Gno realms. It supports conditional rendering of logs and metadata, toggleable via query parameters.

Key Features: - Log collection and display using Markdown formatting. - Metadata display for realm path, address, and height. - Collapsible debug section for cleaner presentation. - Query-based debug toggle using `?debug=1`.

Functions 3

func IsEnabled

1func IsEnabled(path string) bool
source

IsEnabled checks if the `?debug=1` query parameter is set in the given path. Returns true if debugging is enabled, otherwise false.

func Render

1func Render(path string) string
source

Render displays metadata about the current realm but does not display logs. This function uses a default Debug struct with metadata enabled and no logs.

func ToggleURL

1func ToggleURL(path string) string
source

ToggleURL modifies the given path's query string to toggle the `?debug=1` parameter. If debugging is currently enabled, it removes the parameter. If debugging is disabled, it adds the parameter.

Types 1

type Debug

struct
1type Debug struct {
2	Logs         []string
3	HideMetadata bool
4}
source

Debug encapsulates debug information, including logs and metadata.

Methods on Debug

func Log

method on Debug
1func (d *Debug) Log(line string)
source

Log appends a new line of debug information to the Logs slice.

func Render

method on Debug
1func (d Debug) Render(path string) string
source

Render generates the debug content as a collapsible Markdown section. It conditionally renders logs and metadata if enabled via the `?debug=1` query parameter.

Imports 7

Source Files 3