[tor-commits] [tor/master] Extract the locking and logging code