updated the log_level function
looping files