log when profiling
log when writing to file