Fix header injection

Summary: This is a minimal fix (suitable for hotfixing) for
the attached task.

Reviewed By: @jasone

Differential Revision: D1730314
Properly functorize logging code too

Summary: Cleaning up some code

Reviewed By: @int3

Differential Revision: D1751962

Signature: t1:1751962:1419026223:2bec3f80fafa7a227f03510a4d49eb2e3b3e6f03