mirror of
https://github.com/gohugoio/hugoDocs.git
synced 2025-09-14 18:54:50 -04:00
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
This commit is contained in:
parent
0cf8dc046c
commit
efd1821bd7
26
content/functions/errorf.md
Normal file
26
content/functions/errorf.md
Normal file
@ -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 }}
|
||||||
|
```
|
Loading…
x
Reference in New Issue
Block a user