Will check for an OS environment variable named `HUGO_FILE_LOG_FORMAT`.
The tokens available are `:file` (absolute filename), `:line` (line number) and `:col` (column number).
The default format is: \":file::line::col\"`
How to set OS environment variables is OS specific, but an example on Unix setting an alternative format when running Hugo:
```bash
env HUGO_FILE_LOG_FORMAT="\":file::line\"" hugo
```
The above will include filename and line number quoted.
Fixes#5352
`*json.UnmarshalTypeError` and `*json.SyntaxError` has a byte `Offset`, so use that.
This commit also reworks/simplifies the errror line matching logic. This also makes the file reading unbuffered, but that should be fine in this error case.
See #5324
The main item in this commit is showing of errors with a file context when running `hugo server`.
This can be turned off: `hugo server --disableBrowserError` (can also be set in `config.toml`).
But to get there, the error handling in Hugo needed a revision. There are some items left TODO for commits soon to follow, most notable errors in content and config files.
Fixes#5284Fixes#5290
See #5325
See #5324