Hugo: Add some colors to the ERROR and WARNING labels

Created on 15 Feb 2018  路  14Comments  路  Source: gohugoio/hugo

Would the maintainers be open to the idea of adding some colors to hugo server output?

Sometimes I keep refactoring content/themes and I don't realize I made an error some time ago. This is mostly because the console output from hugo server prints error messages without color, so these messages not stand out and alert me.

Enhancement

Most helpful comment

The error messages tend to get pretty long, so I would not be a big fan of painting it all red ... We could consider making the "ERROR" label red.

All 14 comments

The error messages tend to get pretty long, so I would not be a big fan of painting it all red ... We could consider making the "ERROR" label red.

Yes that sounds quite ideal.

consider making the "ERROR" label red.

and "WARN" labels in yellow?

Orange would be most preferable for warnings.

ack related tip removed.

OK, we make the labels only red (ERROR) and orange (WARNING).

@bep Yes, I understand. I can always override that using ack.

I though prefer this touch:

image

That way, one does not need to hunt for the file name and line number.


Also, a slightly related tweak request..

You see that in the error:

Failed to add template "_default/headless-bundle-single.html" in path "/home/kmodi/stow/pub_dotfiles/emacs/dot-emacs.d/elisp/ox-hugo/test/site/layouts/_default/headless-bundle-single.html": template: /home/kmodi/stow/pub_dotfiles/emacs/dot-emacs.d/elisp/ox-hugo/test/site/layouts/_default/headless-bundle-single.html:39: function "c" not defined

the parts that I have emphasized are redundant.. those are the hugo site base dir (the one containing content/, etc.). I am running hugo server from that directory.. so having that information is useless.

So was wondering if the whole /home/kmodi/stow/pub_dotfiles/emacs/dot-emacs.d/elisp/ox-hugo/test/site can be replaced by something short like .

So the same error will look like:

Failed to add template "_default/headless-bundle-single.html" in path "/layouts/_default/headless-bundle-single.html": template: /layouts/_default/headless-bundle-single.html:39: function "c" not defined

And instead, the replaced information can be moved to:

Change detected, rebuilding site '/home/kmodi/stow/pub_dotfiles/emacs/dot-emacs.d/elisp/ox-hugo/test/site'

instead of the current:

Change detected, rebuilding site

@kaushalmodi I think these ack tips belong in the tips section of the forum.

This is about the built-in CLI in Hugo.

@bep I agree, I have removed that stuff.

But can you please comment on removing the redundant directory names from the file paths?

Instead of seeing something like:

Change detected, rebuilding site
2018-02-15 14:10:50.055 -0500
Source changed "/home/kmodi/stow/pub_dotfiles/emacs/dot-emacs.d/elisp/ox-hugo/test/site/content/articles/article-1.md": REMOVE
Source changed "/home/kmodi/stow/pub_dotfiles/emacs/dot-emacs.d/elisp/ox-hugo/test/site/content/articles/article-2.md": REMOVE
Source changed "/home/kmodi/stow/pub_dotfiles/emacs/dot-emacs.d/elisp/ox-hugo/test/site/content/articles": REMOVE
Source changed "/home/kmodi/stow/pub_dotfiles/emacs/dot-emacs.d/elisp/ox-hugo/test/site/content/assignments": REMOVE
Source changed "/home/kmodi/stow/pub_dotfiles/emacs/dot-emacs.d/elisp/ox-hugo/test/site/content/posts/auto-set-lastmod.md": REMOVE
Source changed "/home/kmodi/stow/pub_dotfiles/emacs/dot-emacs.d/elisp/ox-hugo/test/site/content/posts/blackfriday-ext-enabling-disabling-toml.md": REMOVE
Source changed "/home/kmodi/stow/pub_dotfiles/emacs/dot-emacs.d/elisp/ox-hugo/test/site/content/posts/blackfriday-ext-enabling-disabling-yaml.md": REMOVE
Source changed "/home/kmodi/stow/pub_dotfiles/emacs/dot-emacs.d/elisp/ox-hugo/test/site/content/posts/blackfriday-ext-hardlinebreak-wrong-case-toml.md": REMOVE
Source changed "/home/kmodi/stow/pub_dotfiles/emacs/dot-emacs.d/elisp/ox-hugo/test/site/content/posts/blackfriday-fractions-false.md": REMOVE
Source changed "/home/kmodi/stow/pub_dotfiles/emacs/dot-emacs.d/elisp/ox-hugo/test/site/content/posts/blackfriday-fractions-true.md": REMOVE
Source changed "/home/kmodi/stow/pub_dotfiles/emacs/dot-emacs.d/elisp/ox-hugo/test/site/content/posts/cat-a-and-cat-b.md": REMOVE
Source changed "/home/kmodi/stow/pub_dotfiles/emacs/dot-emacs.d/elisp/ox-hugo/test/site/content/posts/cat-a-post-1.md": REMOVE
Source changed "/home/kmodi/stow/pub_dotfiles/emacs/dot-emacs.d/elisp/ox-hugo/test/site/content/posts/checklist.md": REMOVE

it will be nice to have:

Change detected, rebuilding site '/home/kmodi/stow/pub_dotfiles/emacs/dot-emacs.d/elisp/ox-hugo/test/site'
2018-02-15 14:10:50.055 -0500
Source changed "<ROOT>/content/articles/article-1.md": REMOVE
Source changed "<ROOT>/content/articles/article-2.md": REMOVE
Source changed "<ROOT>/content/articles": REMOVE
Source changed "<ROOT>/content/assignments": REMOVE
Source changed "<ROOT>/content/posts/auto-set-lastmod.md": REMOVE
Source changed "<ROOT>/content/posts/blackfriday-ext-enabling-disabling-toml.md": REMOVE
Source changed "<ROOT>/content/posts/blackfriday-ext-enabling-disabling-yaml.md": REMOVE
Source changed "<ROOT>/content/posts/blackfriday-ext-hardlinebreak-wrong-case-toml.md": REMOVE
Source changed "<ROOT>/content/posts/blackfriday-fractions-false.md": REMOVE
Source changed "<ROOT>/content/posts/blackfriday-fractions-true.md": REMOVE
Source changed "<ROOT>/content/posts/cat-a-and-cat-b.md": REMOVE
Source changed "<ROOT>/content/posts/cat-a-post-1.md": REMOVE
Source changed "<ROOT>/content/posts/checklist.md": REMOVE

Probably I should open another issue for this?

But can you please comment on removing the redundant directory names from the file paths?

I'm not a big fan of issues starting out as some very specific, but drift into something only vaguely related.

It makes a practical issue (do this one specific thing) into something very muddy.

It would be nice to have a beep about the error. In the old days, programs were able to squeak through the pc-speaker.

It would be nice to have a beep about the error.

Not sure that folks at work will appreciate my machine beeping on Hugo errors. :)

This was a little trickier than I thought, and needs to hold a little. Also see #5344

Was this page helpful?
0 / 5 - 0 ratings