Explorar el Código

This is ugly, but it improves the current setup.

tags/v1.0^2
Ben Kurtovic hace 10 años
padre
commit
9f935bbb74
Se han modificado 1 ficheros con 7 adiciones y 4 borrados
  1. +7
    -4
      bitshift/crawler/crawl.py

+ 7
- 4
bitshift/crawler/crawl.py Ver fichero

@@ -33,10 +33,13 @@ def crawl():
thread.start()

def _configure_logging():
LOG_FILE_DIR = "log"
# This isn't ideal, since it means the bitshift python package must be kept
# inside the app, but it works for now:
root = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", ".."))
log_dir = os.path.join(root, "logs")

if not os.path.exists(LOG_FILE_DIR):
os.mkdir(LOG_FILE_DIR)
if not os.path.exists(log_dir):
os.mkdir(log_dir)

logging.getLogger("requests").setLevel(logging.WARNING)
logging.getLogger("urllib3").setLevel(logging.WARNING)
@@ -46,7 +49,7 @@ def _configure_logging():
" %(message)s"), datefmt="%y-%m-%d %H:%M:%S")

handler = logging.handlers.TimedRotatingFileHandler(
"%s/%s" % (LOG_FILE_DIR, "app.log"), when="H", interval=1,
"%s/%s" % (log_dir, "app.log"), when="H", interval=1,
backupCount=20)
handler.setFormatter(formatter)



Cargando…
Cancelar
Guardar