Cleanup: Extract log utils into pkg/log

Carry of #7222 -- all tests pass, squashed and rebased against master.

/cc @vieux @capoferro
I almost did convert to stdlib `log`, but didn't want to change too much at once.