package debug
import "github.com/gohugoio/hugo/tpl/debug"
Package debug provides template functions to help debugging templates.
Index ¶
- type Namespace
- func New(d *deps.Deps) *Namespace
- func (ns *Namespace) Dump(val any) string
- func (ns *Namespace) TestDeprecationErr(item, alternative string) string
- func (ns *Namespace) TestDeprecationInfo(item, alternative string) string
- func (ns *Namespace) TestDeprecationWarn(item, alternative string) string
- func (ns *Namespace) Timer(name string) Timer
- func (ns *Namespace) VisualizeSpaces(val any) string
- type Timer
Types ¶
type Namespace ¶
type Namespace struct {
// contains filtered or unexported fields
}
Namespace provides template functions for the "debug" namespace.
func New ¶
New returns a new instance of the debug-namespaced template functions.
func (*Namespace) Dump ¶
Dump returns a object dump of val as a string. Note that not every value passed to Dump will print so nicely, but we'll improve on that.
We recommend using the "go" Chroma lexer to format the output nicely.
Also note that the output from Dump may change from Hugo version to the next, so don't depend on a specific output.
func (*Namespace) TestDeprecationErr ¶
Internal template func, used in tests only.
func (*Namespace) TestDeprecationInfo ¶
Internal template func, used in tests only.
func (*Namespace) TestDeprecationWarn ¶
Internal template func, used in tests only.
func (*Namespace) Timer ¶
func (*Namespace) VisualizeSpaces ¶
VisualizeSpaces returns a string with spaces replaced by a visible string.
type Timer ¶
type Timer interface { // Stop stops the timer and returns an empty string. // Stop can be called multiple times, but only the first call will stop the timer. // If Stop is not called, the timer will be stopped when the build ends. Stop() string }
Timer is a timer that can be stopped.
Source Files ¶
- Version
- v0.144.2 (latest)
- Published
- Feb 19, 2025
- Platform
- linux/amd64
- Imports
- 11 packages
- Last checked
- 7 hours ago –
Tools for package owners.