Skip to content

Commit

Permalink
Move logger from __init__.py to utils.py
Browse files Browse the repository at this point in the history
This will avoid circular dependency when we need to import from utils in
__init__.py.
  • Loading branch information
karenc committed Aug 15, 2017
1 parent 5091c38 commit 4a82ebf
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
11 changes: 1 addition & 10 deletions dbmigrator/__init__.py
Original file line number Diff line number Diff line change
@@ -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',)
10 changes: 9 additions & 1 deletion dbmigrator/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import difflib
import functools
import glob
import logging
import os
import pkg_resources
import re
Expand All @@ -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):
Expand Down

0 comments on commit 4a82ebf

Please sign in to comment.