We always need to call next_client_auth_hook
Call the next ProcessUtility_hook before logging

It's not clear to me if this is entirely safe, but the code is cleaner
this way. If there are any problems, I'll find them while testing.
Split logging out of the hook functions, to simplify code

It's not safe to call the next/standard hook before logging, and the
logging is typically more code than I want to wrap in "if (enabled)",
so this is a more straightforward way to do it.

Also contains some simplifications of the logging code itself.

Untested.
Allow building in contrib/