hooks: lock on the logger before printing to stderr, printf args

Fixes two things:

- Missing printf argument.
- Prevent the logger from possibly mixing it's diagnostic output to stderr with concurrent logging.

r: @Sirupsen