Reworked code to allow multiple loggers on 1 file

Made it so the 'stream' object only exists when writing to the file to
allow multiple loggers on the same file.