Add purging of message queues to loader.

- Add purge of message queues after loading all messages to avoid empty
  intermediate directories filling up top directory. Only purges if
  messages found to reduce overhead.
Tidy and improve dbloader log message output.

- Add traceback for unexpected exceptions using logging.exception().
- Remove pointless type(exception) as this would always return 'instance'.
Unlock current message queue element on shutdown.

- Add unlocking of current msg queue element to shutdown method so no
  locked elements left if shutdown called during long loading operation.
- To support first change, make current element reference an instance
  object so it can be queried by shutdown method.
- Correct string formatting conversion in log message.
Improve log message output of loader.

- Message name (i.e. directory) is printed as well as the ID from the
  originating queue. Should help locate messages.
- General imporvements to log formatting and consistency.
Update docstring for load_all_msgs.
Refactor dbloader to remove duplicated code

Use a try...except block in run_as_daemon to hold the shutdown logic
duplicated between different try...except clauses.

Change log messages to use % formatting rather than string concatanation.
Change self.name to self.current_msg in loader.py

Change self.name to be more descriptive and check in the shutdown
function that it has been assigneed to as it may not have been before a
shutdown is initiated.
Merge pull request #6 from apel/queue_purge

Queue purging