Add status logging functions.

Instead of using printf() and perror() to print error messages, use our own
thing.  This will allow suppression and/or saving error and information
messages to a file instead of printing them to the stdout.

There are levels of messages, each one with a different color. Critical
level aborts the program, perror level works pretty much like perror() (by
calling strerror() and obtaining the error reason from errno).

As a bonus, if compiling in debug mode, the file name, line number, function
name, and thread ID are printed before each message.