Generally speaking, using a log file to write some information is considered a better practice than writing the same output on the screen for two reasons:
The output does not get lost as it is stored in a file
You can search and process log files using Unix tools such as grep(1), awk(1), and sed(1), which cannot be done when messages are printed on a Terminal window
Logging functions can be extremely handy for debugging your programs, especially server processes written in Go, so you should not undervalue their power.
The logging level is a value that specifies the severity of the log entry. Various logging levels exist including
emerg (in reverse order of severity).