Skip to content

Instantly share code, notes, and snippets.

@senaps
Created July 24, 2018 18:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save senaps/93651829b536ab19836ca72ba22140d4 to your computer and use it in GitHub Desktop.
Save senaps/93651829b536ab19836ca72ba22140d4 to your computer and use it in GitHub Desktop.
logging boierplate this module should be included in the project and be used as the logger mechanism
import sys
import logging
# handlers = {
# 'stream': logging.StreamHandler(sys.stdout),
# 'errstream': logging.StreamHandler(sys.stderr),
# 'file': logging.FileHandler,
# 'null': logging.NullHandler,
# 'rotatefile': logging.handlers.RotatingFileHandler,
# 'syslog': logging.handlers.SysLogHandler,
# }
def make_logger():
"""create the logging object
:return:
"""
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)
handler = logging.StreamHandler(sys.stdout)
handler.setFormatter(
logging.Formatter(
'[%(asctime)s] %(levelname)s in %(module)s: %(message)s'))
logger.addHandler(handler)
return logger
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment