Add purge logging facility
Merge pull request #12 from guillaumelecerf/logging

Looks good, thanks for the additional code changes.