def _open_log_file(filename):
 global _LOG_FILE_HANDLES, _LOGDIR
 if (not _LOGDIR):
  from django.conf import settings
  _LOGDIR = settings.LOG_DIR
 filename = os.path.join(_LOGDIR, filename)
 if (filename in _LOG_FILE_HANDLES):
  return _LOG_FILE_HANDLES[filename]
 else:
  try:
   filehandle = open(filename, 'a+')
   _LOG_FILE_HANDLES[filename] = filehandle
   return filehandle
  except IOError:
   log_trace()
 return None

def _open_log_file ( filename ) : global _LOG_FILE_HANDLES , _LOGDIR if ( not _LOGDIR ) : from django . conf import settings _LOGDIR = settings . LOG_DIR filename = os . path . join ( _LOGDIR , filename ) if ( filename in _LOG_FILE_HANDLES ) : return _LOG_FILE_HANDLES [ filename ] else : try : filehandle = open ( filename , 'a+' ) _LOG_FILE_HANDLES [ filename ] = filehandle return filehandle except IOError : log_trace ( ) return None
helper to open the log file and cache its handle .