mirror of
https://github.com/gohugoio/hugo.git
synced 2025-04-29 07:00:31 +03:00
parent
1083bf7c08
commit
fc7de7136a
1157 changed files with 0 additions and 64232 deletions
|
@ -1,45 +0,0 @@
|
|||
---
|
||||
title: debug.Dump
|
||||
description: Returns an object dump as a string.
|
||||
categories: []
|
||||
keywords: []
|
||||
action:
|
||||
aliases: []
|
||||
related: []
|
||||
returnType: string
|
||||
signatures: [debug.Dump VALUE]
|
||||
---
|
||||
|
||||
```go-html-template
|
||||
{{ $data := "" }}
|
||||
{{ $p := "data/books.json" }}
|
||||
{{ with resources.Get $p }}
|
||||
{{ $opts := dict "delimiter" "," }}
|
||||
{{ $data = . | transform.Unmarshal $opts }}
|
||||
{{ else }}
|
||||
{{ errorf "Unable to get resource %q" $p }}
|
||||
{{ end }}
|
||||
```
|
||||
|
||||
```go-html-template
|
||||
<pre>{{ debug.Dump $data }}</pre>
|
||||
```
|
||||
|
||||
```text
|
||||
[]interface {}{
|
||||
map[string]interface {}{
|
||||
"author": "Victor Hugo",
|
||||
"rating": 5.0,
|
||||
"title": "Les Misérables",
|
||||
},
|
||||
map[string]interface {}{
|
||||
"author": "Victor Hugo",
|
||||
"rating": 4.0,
|
||||
"title": "The Hunchback of Notre Dame",
|
||||
},
|
||||
}
|
||||
```
|
||||
|
||||
{{% note %}}
|
||||
Output from this function may change from one release to the next. Use for debugging only.
|
||||
{{% /note %}}
|
|
@ -1,37 +0,0 @@
|
|||
---
|
||||
title: debug.Timer
|
||||
description: Creates a named timer that reports elapsed time to the console.
|
||||
categories: []
|
||||
keywords: []
|
||||
action:
|
||||
aliases: []
|
||||
related: []
|
||||
returnType: debug.Timer
|
||||
signatures: [debug.Timer NAME]
|
||||
---
|
||||
|
||||
{{< new-in 0.120.0 >}}
|
||||
|
||||
Use the `debug.Timer` function to determine execution time for a block of code, useful for finding performance bottle necks in templates.
|
||||
|
||||
The timer starts when you instantiate it, and stops when you call its `Stop` method.
|
||||
|
||||
```go-html-template
|
||||
{{ $t := debug.Timer "TestSqrt" }}
|
||||
{{ range seq 2000 }}
|
||||
{{ $f := math.Sqrt . }}
|
||||
{{ end }}
|
||||
{{ $t.Stop }}
|
||||
```
|
||||
|
||||
Use the `--logLevel info` command line flag when you build the site.
|
||||
|
||||
```sh
|
||||
hugo --logLevel info
|
||||
```
|
||||
|
||||
The results are displayed in the console at the end of the build. You can have as many timers as you want and if you don't stop them, they will be stopped at the end of build.
|
||||
|
||||
```text
|
||||
INFO timer: name TestSqrt total 12.429355ms
|
||||
```
|
|
@ -1,12 +0,0 @@
|
|||
---
|
||||
title: Debug functions
|
||||
linkTitle: debug
|
||||
description: Template functions to debug your templates.
|
||||
categories: []
|
||||
keywords: []
|
||||
menu:
|
||||
docs:
|
||||
parent: functions
|
||||
---
|
||||
|
||||
Use these functions to debug your templates.
|
Loading…
Add table
Add a link
Reference in a new issue