# Add debugf function

**URL:** https://discourse.gohugo.io/t/add-debugf-function/45625
**Category:** feature
**Created:** [August 5, 2023, 11:17pm UTC](https://discourse.gohugo.io/t/add-debugf-function/45625 "2023-08-05T23:17:13Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![will](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/will/32/18403_2.png) [@will](https://discourse.gohugo.io/u/will)
#### Post date: [August 5, 2023, 11:17pm UTC](https://discourse.gohugo.io/t/add-debugf-function/45625/1 "2023-08-05T23:17:14Z")

</div>

It would be very convenient to have a `debugf` function, where the output isn’t cached like `errorf` or `warnf`, but it would still be highlighted like their output. Debug output would be suppressed unless the `-v` verbose flag is given. Output would be prefixed by template filename and line if possible.

---

<div class="post-metadata">

### Author: ![simonheimlicher](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/simonheimlicher/32/20004_2.png) [@simonheimlicher](https://discourse.gohugo.io/u/simonheimlicher)
#### Post date: [January 27, 2024, 7:57pm UTC](https://discourse.gohugo.io/t/add-debugf-function/45625/2 "2024-01-27T19:57:46Z")

</div>

I would also love to see this function and having both file name and line number would be incredibly useful.

---

<div class="post-metadata">

### Author: ![jmooring](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jmooring/32/4214_2.png) [@jmooring](https://discourse.gohugo.io/u/jmooring)
#### Post date: [January 27, 2024, 8:16pm UTC](https://discourse.gohugo.io/t/add-debugf-function/45625/3 "2024-01-27T20:16:12Z")

</div>

[https://github.com/gohugoio/hugo/issues/11739](https://github.com/gohugoio/hugo/issues/11739)
