use dedicated logger for dynamodb2 (#4692)
This commit is contained in:
parent
2c093abb29
commit
fb1a828fe3
@ -32,6 +32,9 @@ from moto.dynamodb2.exceptions import InvalidTokenException, InvalidUpdateExpres
|
|||||||
from moto.dynamodb2.parsing.tokens import Token, ExpressionTokenizer
|
from moto.dynamodb2.parsing.tokens import Token, ExpressionTokenizer
|
||||||
|
|
||||||
|
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class NestableExpressionParserMixin(object):
|
class NestableExpressionParserMixin(object):
|
||||||
"""
|
"""
|
||||||
For nodes that can be nested in themselves (recursive). Take for example UpdateExpression's grammar:
|
For nodes that can be nested in themselves (recursive). Take for example UpdateExpression's grammar:
|
||||||
@ -61,7 +64,7 @@ class NestableExpressionParserMixin(object):
|
|||||||
Returns:
|
Returns:
|
||||||
|
|
||||||
"""
|
"""
|
||||||
logging.debug(
|
logger.debug(
|
||||||
"Move token pos {pos} to continue parsing with specific factory class {fc}".format(
|
"Move token pos {pos} to continue parsing with specific factory class {fc}".format(
|
||||||
pos=self.token_pos, fc=factory_class.__class__.__name__
|
pos=self.token_pos, fc=factory_class.__class__.__name__
|
||||||
)
|
)
|
||||||
@ -69,7 +72,7 @@ class NestableExpressionParserMixin(object):
|
|||||||
# noinspection PyProtectedMember
|
# noinspection PyProtectedMember
|
||||||
ast, token_pos = factory_class(**self._initializer_args())._parse_with_pos()
|
ast, token_pos = factory_class(**self._initializer_args())._parse_with_pos()
|
||||||
self.target_clauses.append(ast)
|
self.target_clauses.append(ast)
|
||||||
logging.debug(
|
logger.debug(
|
||||||
"Continue where previous parsing ended {token_pos}".format(
|
"Continue where previous parsing ended {token_pos}".format(
|
||||||
token_pos=token_pos
|
token_pos=token_pos
|
||||||
)
|
)
|
||||||
@ -275,7 +278,7 @@ class ExpressionParser(metaclass=abc.ABCMeta):
|
|||||||
self.token_pos += 1
|
self.token_pos += 1
|
||||||
except IndexError:
|
except IndexError:
|
||||||
assert self.token_pos > 0, "We should always have positive indexes"
|
assert self.token_pos > 0, "We should always have positive indexes"
|
||||||
logging.debug("We are out of range so end is reached")
|
logger.debug("We are out of range so end is reached")
|
||||||
|
|
||||||
def process_token_of_type(self, token_type):
|
def process_token_of_type(self, token_type):
|
||||||
"""
|
"""
|
||||||
@ -355,7 +358,7 @@ class NestableBinExpressionParser(ExpressionParser):
|
|||||||
**self._initializer_args()
|
**self._initializer_args()
|
||||||
)._parse_with_pos()
|
)._parse_with_pos()
|
||||||
self.target_nodes.append(ast)
|
self.target_nodes.append(ast)
|
||||||
logging.debug(
|
logger.debug(
|
||||||
"Continue where previous parsing ended {token_pos}".format(
|
"Continue where previous parsing ended {token_pos}".format(
|
||||||
token_pos=self.token_pos
|
token_pos=self.token_pos
|
||||||
)
|
)
|
||||||
@ -477,7 +480,7 @@ class UpdateExpressionParser(ExpressionParser, NestableExpressionParserMixin):
|
|||||||
while True:
|
while True:
|
||||||
self.skip_white_space()
|
self.skip_white_space()
|
||||||
if self.is_at_end():
|
if self.is_at_end():
|
||||||
logging.debug("End reached")
|
logger.debug("End reached")
|
||||||
break
|
break
|
||||||
elif self._parse_by_a_subfactory():
|
elif self._parse_by_a_subfactory():
|
||||||
continue
|
continue
|
||||||
@ -556,7 +559,7 @@ class UpdateExpressionActionsParser(ExpressionParser, NestableExpressionParserMi
|
|||||||
break
|
break
|
||||||
|
|
||||||
if len(self.target_clauses) == 0:
|
if len(self.target_clauses) == 0:
|
||||||
logging.debug(
|
logger.debug(
|
||||||
"Didn't encounter a single {nc} in {nepc}.".format(
|
"Didn't encounter a single {nc} in {nepc}.".format(
|
||||||
nc=self._nestable_class().__name__,
|
nc=self._nestable_class().__name__,
|
||||||
nepc=self._nested_expression_parser_class().__name__,
|
nepc=self._nested_expression_parser_class().__name__,
|
||||||
|
Loading…
Reference in New Issue
Block a user