diff --git a/dbmigrator/__init__.py b/dbmigrator/__init__.py index 39ca5c5..97b3473 100644 --- a/dbmigrator/__init__.py +++ b/dbmigrator/__init__.py @@ -1,15 +1,6 @@ # -*- coding: utf-8 -*- -import logging -import sys - -logger = logging.getLogger('dbmigrator') -logger.setLevel(logging.INFO) - -handler = logging.StreamHandler(sys.stdout) -handler.setFormatter(logging.Formatter( - '[%(levelname)s] %(name)s (%(filename)s) - %(message)s')) -logger.addHandler(handler) +from .utils import logger __all__ = ('logger',) diff --git a/dbmigrator/utils.py b/dbmigrator/utils.py index caa4ee6..d6afd37 100644 --- a/dbmigrator/utils.py +++ b/dbmigrator/utils.py @@ -15,6 +15,7 @@ import difflib import functools import glob +import logging import os import pkg_resources import re @@ -25,7 +26,14 @@ import psycopg2 from psycopg2.extensions import POLL_OK, POLL_READ, POLL_WRITE -from . import logger + +logger = logging.getLogger('dbmigrator') +logger.setLevel(logging.INFO) + +handler = logging.StreamHandler(sys.stdout) +handler.setFormatter(logging.Formatter( + '[%(levelname)s] %(name)s (%(filename)s) - %(message)s')) +logger.addHandler(handler) # psycopg2 / libpq doesn't respond to SIGINT (ctrl-c):