Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def close_log_file(filename):
global _open_log_files, _log_file_dir, _log_lock
remove = []
if not _acquire_lock(_log_lock):
raise LogLockError("Could not acquire exclusive lock to access"
" _open_log_files")
try:
for k in _open_log_files:
if os.path.basename(k) == filename:
f = _open_log_files[k]
f.close()
remove.append(k)
if remove:
for key_to_remove in remove:
_open_log_files.pop(key_to_remove)
finally:
_log_lock.release()