How do I debug

Hello all.

So a lot has changed during the past few months (a year?). Back when I was working with goHugo, I was using the 0.101.0 and now when I have to rework things out, I think the latest is 0.141.0.

I am working on VSCode with vanilla goHugo codes - I call them vanilla as these are very basic codes of goHugo and those are what have been handed to me. I understand there will be a steep learning curve now going by the fact that the versions are quite well advanced. So for now, I am only going to debug the errors instead of redoing them as per the new standards.

Now there are a few things that I would like to know -

  1. The --debug and --verbose options are obsolete and not valid flags. So how do I check or rather debug? I am sure, if these things are removed, there might be some other alternates - just that I am not able to figure those out.
  2. The next issue is with the --printMemoryUsage flag. It gives me output which I am unable to understand -
Alloc = 1.3 GB
TotalAlloc = 104.8 GB
Sys = 2.3 GB
NumGC = 161

Now I guess these should be related to memory but still I am not able to figure them out. I was searching on the forums and I did find a similar question here - What is --printMemoryUsage detailling about? but it does not do any good in explaining what those values actually are for.

hugo helpis your friend:

Flags:
...
      --logLevel string            log level (debug|info|warn|error)
...

It is likely the “Sys” (System memory) value that is most interesting.

2.3 GB indicated you are building a large site and/or process a lot of images.

My personal blog uses only 150 MB.

@deining

Dang! After you mentioned the

–loglevel string

I looked at the hugo server --help output more closely and found it was under the Global Flags section. I had been looking for this somewhere at the -l (way up somewhere in the middle.

Thank you for helping me with this one. Appreciated.

Thanks again!

Yes, they have a site which was built on goHugo 0.101.0 and results in over 10 gigs! And now I have been asked to redo it in someway that the build time and also the built size is less. It will definitely take a while as they have almost a 100 layouts+partials on code.

The figures for Alloc and Total Alloc keep changing (sometime they are high and sometime they decrease - and that is where it makes things confusing for me). Maybe they are for threads or temporary resources

I think that NumGC is more of the thread count, but somewhere towards the middle, it remains constant for a few displays.

If your main goal is to get the existing project running, using log info would be quite helpful. It allows you to output messages at different levels, get error details, and assist in debugging. This should be sufficient for making the necessary fixes.