Added directory logging function