Rename log object to logger (to follow the standard)
This commit is contained in:
1 parent
bfb32ba312
commit
555d17adcd
2 files changed
+9
-9
No files matched your search
@@ -21,7 +21,7 @@ import sys
|
||||
from . import utils
|
||||
from .sql_analyser import analyse_sql_statements
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class MigrationLinter(object):
|
||||
@@ -134,7 +134,7 @@ class MigrationLinter(object):
|
||||
self.django_path,
|
||||
self.python_exe, app_name, migration_name,
|
||||
self.database)
|
||||
log.info('Executing {0}'.format(sqlmigrate_command))
|
||||
logger.info('Executing {0}'.format(sqlmigrate_command))
|
||||
sqlmigrate_process = Popen(
|
||||
sqlmigrate_command, shell=True, stdout=PIPE, stderr=PIPE)
|
||||
|
||||
@@ -148,7 +148,7 @@ class MigrationLinter(object):
|
||||
_, err = sqlmigrate_process.communicate()
|
||||
raise RuntimeError('sqlmigrate command failed {0}'.format(
|
||||
err.decode('utf-8')))
|
||||
log.info('Found {0} sql migration lines'.format(len(sql_statements)))
|
||||
logger.info('Found {0} sql migration lines'.format(len(sql_statements)))
|
||||
return sql_statements
|
||||
|
||||
def _gather_migrations_git(self, git_commit_id):
|
||||
@@ -158,7 +158,7 @@ class MigrationLinter(object):
|
||||
'cd {0} && '
|
||||
'git diff --name-only --diff-filter=A {1}').format(
|
||||
self.django_path, git_commit_id)
|
||||
log.info('Executing {0}'.format(git_diff_command))
|
||||
logger.info('Executing {0}'.format(git_diff_command))
|
||||
diff_process = Popen(
|
||||
git_diff_command, shell=True, stdout=PIPE, stderr=PIPE)
|
||||
for line in map(
|
||||
@@ -177,7 +177,7 @@ class MigrationLinter(object):
|
||||
for line in map(
|
||||
utils.clean_bytes_to_str, diff_process.stderr.readlines()):
|
||||
output.append(line)
|
||||
log.info("Error while git diff command:\n{}".format(
|
||||
logger.info("Error while git diff command:\n{}".format(
|
||||
"".join(output)))
|
||||
raise Exception('Error while executing git diff command')
|
||||
return migrations
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
import re
|
||||
import logging
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def has_default(sql, **kwargs):
|
||||
@@ -24,7 +24,7 @@ def has_default(sql, **kwargs):
|
||||
for err in kwargs['errors']
|
||||
if err['code'] == 'NOT_NULL')
|
||||
if err:
|
||||
log.info(
|
||||
logger.info(
|
||||
('Found a NOT_NULL error in migration, '
|
||||
'but it has a default value added: {}').format(err))
|
||||
kwargs['errors'].remove(err)
|
||||
@@ -70,7 +70,7 @@ def analyse_sql_statements(sql_statements):
|
||||
for statement in sql_statements:
|
||||
for test in migration_tests:
|
||||
if test['fn'](statement, errors=errors):
|
||||
log.info('Testing {0} -- ERROR'.format(statement))
|
||||
logger.info('Testing {0} -- ERROR'.format(statement))
|
||||
table_search = re.search(
|
||||
'TABLE `([^`]*)`', statement, re.IGNORECASE)
|
||||
col_search = re.search(
|
||||
@@ -83,7 +83,7 @@ def analyse_sql_statements(sql_statements):
|
||||
}
|
||||
errors.append(err)
|
||||
else:
|
||||
log.info('Testing {0} -- PASSED'.format(statement))
|
||||
logger.info('Testing {0} -- PASSED'.format(statement))
|
||||
return {
|
||||
'errors': errors,
|
||||
}
|
||||
Reference in new issue
Block a user