Skip to content

Commit

Permalink
Fix calls to logger
Browse files Browse the repository at this point in the history
  • Loading branch information
erik committed Jan 7, 2019
1 parent ace5fe6 commit aecb5a0
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 10 deletions.
1 change: 0 additions & 1 deletion squabble/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import logging


logging.basicConfig()
logger = logging.getLogger(__name__)


Expand Down
2 changes: 2 additions & 0 deletions squabble/__main__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import logging
import sys

import colorama
Expand All @@ -6,6 +7,7 @@


def main():
logging.basicConfig()
colorama.init()
status = cli.main()

Expand Down
5 changes: 3 additions & 2 deletions squabble/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

import glob
import json
import logging
import os.path
import sys

Expand All @@ -33,7 +34,7 @@

import squabble
import squabble.message
from squabble import config, lint, logger, reporter, rule
from squabble import config, lint, reporter, rule


def main():
Expand All @@ -51,7 +52,7 @@ def dispatch_args(args):
Note that some exceptional conditions will terminate the program directly.
"""
if args['--verbose']:
logger.setLevel('DEBUG')
squabble.logger.setLevel('DEBUG')

if args['--list-presets']:
return list_presets()
Expand Down
13 changes: 9 additions & 4 deletions squabble/config.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
import collections
import copy
import json
import logging
import os.path
import re
import subprocess

from squabble import SquabbleException, logger
from squabble import SquabbleException


logger = logging.getLogger(__name__)


Config = collections.namedtuple('Config', [
'reporter',
Expand Down Expand Up @@ -74,8 +79,6 @@ def discover_config_location():
- in the root of the repository (if working in a git repo).
- in the user's home directory.
"""
logger.debug('No config file given, trying to discover')

possible_dirs = [
'.',
_get_vcs_root(),
Expand All @@ -86,12 +89,14 @@ def discover_config_location():
if d is None:
continue

logger.debug('Checking %s for a config file', d)
logger.debug('checking %s for a config file', d)

file_name = os.path.join(d, '.squabblerc')
if os.path.exists(file_name):
logger.debug('using "%s" for configuration', file_name)
return file_name

logger.debug('no config file found')
return None


Expand Down
7 changes: 6 additions & 1 deletion squabble/message.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
from squabble import SquabbleException, logger
import logging

from squabble import SquabbleException


logger = logging.getLogger(__name__)


class DuplicateMessageCodeException(SquabbleException):
Expand Down
6 changes: 5 additions & 1 deletion squabble/rule.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@
import glob
import importlib
import importlib.util as import_util
import logging
import os.path

from squabble import UnknownRuleException, logger
from squabble import UnknownRuleException


logger = logging.getLogger(__name__)


def _load_plugin(path):
Expand Down
6 changes: 5 additions & 1 deletion squabble/rules/require_concurrent_index.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
import logging

import pglast

import squabble.rule
from squabble import logger
from squabble.message import Message
from squabble.rules import BaseRule


logger = logging.getLogger(__name__)


class RequireConcurrentIndex(BaseRule):
"""
Require all new indexes to be created with ``CONCURRENTLY`` so they won't
Expand Down

0 comments on commit aecb5a0

Please sign in to comment.