Refactor how contextual information is added to log records a bit.
Prepare for adding command information to log records.