Skip to content

Instantly share code, notes, and snippets.

View sborquez's full-sized avatar
🤖
AI means love in chinese

Sebastián Bórquez sborquez

🤖
AI means love in chinese
View GitHub Profile
@sborquez
sborquez / log.py
Last active February 6, 2020 22:02 — forked from nguyenkims/log.py
Basic example on how setup a Python logger
import logging
import sys
from logging.handlers import TimedRotatingFileHandler
FORMATTER = logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s")
LOG_FILE = "my_app.log"
def get_console_handler():
console_handler = logging.StreamHandler(sys.stdout)
console_handler.setFormatter(FORMATTER)