Write logs to directories

This adjusts the logging module to have the option to organise the log files into directories rather than one giant pool (pass "-directories" as the first or second word of the argument string to enable this behaviour)