bugfix! should_log race condition

A race condition in the should_log() function could result in
log_timing to be cached incorrectly for a process. This could
result in the tracing not logging timing info even though it
was told to do so.

Signed-off-by: Jeremy C. Andrus <jeremya@cs.columbia.edu>
bugfix! memory corruption in __bt_raw_print

A buffer length was not calculated at the correct time, and resulted
in a memcpy that could potentially corrupt at least one log line and
possibly crash the system.

Signed-off-by: Jeremy C. Andrus <jeremya@cs.columbia.edu>
logging fixups / refactor

Move more code out of macros (to improve cache performance and
shrink library size). Move auto NULL termination and buffer
position reset to __bt_flush.

Signed-off-by: Jeremy C. Andrus <jeremya@cs.columbia.edu>