summaryrefslogtreecommitdiffstats
path: root/docs/content/en/functions/errorf.md
diff options
context:
space:
mode:
Diffstat (limited to 'docs/content/en/functions/errorf.md')
-rw-r--r--docs/content/en/functions/errorf.md14
1 files changed, 4 insertions, 10 deletions
diff --git a/docs/content/en/functions/errorf.md b/docs/content/en/functions/errorf.md
index 04fd0edb0..b3e0fd280 100644
--- a/docs/content/en/functions/errorf.md
+++ b/docs/content/en/functions/errorf.md
@@ -1,19 +1,13 @@
---
title: errorf and warnf
description: Log ERROR or WARNING from the templates.
-date: 2017-09-30
-publishdate: 2017-09-30
-lastmod: 2017-09-30
categories: [functions]
menu:
docs:
- parent: "functions"
+ parent: functions
keywords: [strings, log, error]
signature: ["errorf FORMAT INPUT"]
-workson: []
-hugoversion:
relatedfuncs: [printf]
-deprecated: false
---
`errorf` or `warnf` will evaluate a format string, then output the result to the ERROR or WARNING log (and only once per error message to avoid flooding the log).
@@ -22,11 +16,11 @@ Any ERROR will also cause the build to fail (the `hugo` command will `exit -1`).
Both functions return an empty string, so the messages are only printed to the console.
-```
+```go-html-template
{{ errorf "Failed to handle page %q" .Path }}
```
-```
+```go-html-template
{{ warnf "You should update the shortcodes in %q" .Path }}
```
@@ -38,7 +32,7 @@ Sometimes it may make sense to let the user suppress an ERROR and make the build
You can do this by using the `erroridf` function. This functions takes an error ID as the first argument.
-```
+```go-html-template
{{ erroridf "my-custom-error" "You should consider fixing this." }}
```