add option for sync logging or async