Refactor pending_cb_message_t into a type with proper functions

Also, rename it.
Turn log loop into a for loop, and "Does this lf want this" into a fn
Refactor the 'deliver a log message' logic to its own function.
Remember log messages that happen before logs are configured

(And replay them once we know our first real logs.)

This is an implementation for issue 6938.  It solves the problem of
early log mesages not getting sent to log files, but not the issue of
early log messages not getting sent to controllers.
Merge remote-tracking branch 'public/ticket6938'

Conflicts:
	src/tools/tor-resolve.c