Automatically logging commands