summaryrefslogtreecommitdiffhomepage
path: root/docs
diff options
context:
space:
mode:
authorBrendan Roy <[email protected]>2017-09-30 20:00:19 +1000
committerBjørn Erik Pedersen <[email protected]>2017-10-03 07:59:51 +0200
commit4fc67fe44a3c65fc7faaed21d5fa5bb5f87edf2c (patch)
tree5b9562852eb01c76f31ca4651561785573a50b37 /docs
parent47fdfd5196cd24a23b30afe1d88969ffb413ab59 (diff)
downloadhugo-4fc67fe44a3c65fc7faaed21d5fa5bb5f87edf2c.tar.gz
hugo-4fc67fe44a3c65fc7faaed21d5fa5bb5f87edf2c.zip
tpl: Add errorf template function
Add template function that will build a string from the given format string and arguments, then log it to ERROR. This has an intended side-effect of causing the build to fail, when executed. Resolves #3817
Diffstat (limited to 'docs')
-rw-r--r--docs/content/functions/errorf.md26
1 files changed, 26 insertions, 0 deletions
diff --git a/docs/content/functions/errorf.md b/docs/content/functions/errorf.md
new file mode 100644
index 000000000..9105ff840
--- /dev/null
+++ b/docs/content/functions/errorf.md
@@ -0,0 +1,26 @@
+---
+title: errorf
+linktitle: errorf
+description: Evaluates a format string and logs it to ERROR.
+date: 2017-09-30
+publishdate: 2017-09-30
+lastmod: 2017-09-30
+categories: [functions]
+menu:
+ docs:
+ parent: "functions"
+keywords: [strings, log, error]
+signature: ["errorf FORMAT INPUT"]
+workson: []
+hugoversion:
+relatedfuncs: [printf]
+deprecated: false
+aliases: []
+---
+
+`errorf` will evaluate a format string, then output the result to the ERROR log.
+This will also cause the build to fail.
+
+```
+{{ errorf "Something went horribly wrong! %s" err }}
+```