Log message

I just wondering, is there any possibility to log messages to console from Hugo code. I found only errorf function, but it was designed for errors, and shows error text in the HTML output. Hugo doesn’t have any function that just prints logs into the console?

--verbose and --verboseLog will log “a bit” more with hugo server. but there is no way to debug into the console from a template (like logtoconsole or such).

I believe the verbosity flags just set the verbosity level for the log messages sent by Hugo, but the question is whether you can send your own custom log messages to help debug templates, etc., other than writing a custom template to support this (e.g., by writing to a file).

“but there is no way to debug into the console from a template (like logtoconsole or such).”

1 Like

There is warnf, but a logf would be better, especially if writes could be atomic, and each call could be directed to the file of your choice or the stdout.