I’m trying to create a custom change and error log file that is generated when Hugo runs a build. The goal is to create a friendly log message for users to see when the site has successfully built or when there has been an error (and what that error is).
Background:
I have an automatic build setup which runs when a user edits a content file (content files are shared via OneDrive). I know this is probably dangerous but it works quite well and is a simple process for business users who don’t have to worry about extra steps like running a build - all they need to do is save.
The problem arises when a user writes some incorrect syntax. When this happens it breaks the build and I have no way to easily tell them what the error is.
I have tried using the Hugo config ‘log’ option with ‘verboseLog’ enabled, but this output doesn’t seem to have the same level of error detail I see on the command line and the browser – specifically I want to show them the error, filename and line number. I’d also like more control of the log format to present a more human friendly output.
I’m currently looking into creating a custom script outside of Hugo to read the output on build and the generate a custom log, but I was hoping there might be an easier way using just Hugo.