Add log function and simple profiler.