A hook for handling logs