Moved logging code out of system.fs and into a new file, Logging.fs.
Minor cleanup and refactoring of the logging code.