Support logging messages containing ranges.

This will slowly replace the now-deprecated pos_link mechanism, since this
allows us to produce more helpful error messages that actually highlight
the part of the source code in question (though that highlighting is not
implemented yet.)
Reference the source range when warning about incorrect indentation.
Include a source range in the "unknown symbol" error.
Close the log handler once we're done with it.

This allows the terminal log handler to produce some extra whitespace at
the end of the log, and will allow other loggers to do similar things
in future.
Still need pos_link in the scanner module for now.