#!/usr/bin/python
import logging
import logging.handlers
def set_logger(filename, logmod):
log_size = 100000000
log_backupcount = 1
handler = logging.handlers.RotatingFileHandler(filename, maxBytes=log_size, backupCount=log_backupcount)
formatter = logging.Formatter("%(asctime)s %(levelname)s: %(message)s", datefmt='[%b %d %H:%M:%S]')
handler.setFormatter(formatter)
logger = logging.getLogger(logmod)
logger.setLevel(logging.INFO)
logger.addHandler(handler)
return logger
def get_logger(logmod):
logger = logging.getLogger(logmod)
return logger