from DateTime import DateTime
import os
from Products.ERP5Type.Log import log

directory = "var/log/ingestion"

def logEntry(content):
  now = DateTime()
  day = now.strftime('%Y-%m-%d')
  instant = now.strftime("%Y-%m-%d %H:%M:%S")
  entry = "%s : %s\n" % (str(instant), str(content))
  if not os.path.exists(directory):
    os.makedirs(directory)
  with open("%s/%s.log" % (directory, day), "a") as log_file:
    log_file.write(entry)
    log(entry)
    log_file.write("-------------------\n")