ceph/teuthology/__init__.py
Zack Cerza 29d3299497 Consolidate log file setup into shared function
Signed-off-by: Zack Cerza <zack.cerza@inktank.com>
2014-05-10 09:10:21 -05:00

21 lines
599 B
Python

from gevent import monkey
monkey.patch_all(dns=False)
from .orchestra import monkey
monkey.patch_all()
import logging
logging.basicConfig(
level=logging.INFO,
format='%(asctime)s.%(msecs)03d %(levelname)s:%(name)s:%(message)s')
log = logging.getLogger(__name__)
def setup_log_file(logger, log_path):
log_formatter = logging.Formatter(
fmt=u'%(asctime)s.%(msecs)03d %(levelname)s:%(name)s:%(message)s',
datefmt='%Y-%m-%dT%H:%M:%S')
log_handler = logging.FileHandler(filename=log_path)
log_handler.setFormatter(log_formatter)
logger.addHandler(log_handler)