Skip to content

Commit

Permalink
Merge pull request #142 from chamikaramj/remove_global_error_log_level
Browse files Browse the repository at this point in the history
Updates encoding.py to not to set/reset global logger.
  • Loading branch information
cherba29 authored Jan 30, 2017
2 parents a8536ee + 5cf5daa commit 3334d39
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 14 deletions.
3 changes: 0 additions & 3 deletions apitools/base/protorpclite/protojson.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,9 +272,6 @@ def __decode_dictionary(self, message_type, dictionary):
variant = self.__find_variant(value)
if variant:
message.set_unrecognized_field(key, value, variant)
else:
logging.warning(
'No variant found for unrecognized field: %s', key)
continue

# This is just for consistency with the old behavior.
Expand Down
14 changes: 3 additions & 11 deletions apitools/base/py/encoding.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import collections
import datetime
import json
import logging
import os
import sys

Expand Down Expand Up @@ -276,16 +275,9 @@ def decode_message(self, message_type, encoded_message):
if message_type in _CUSTOM_MESSAGE_CODECS:
return _CUSTOM_MESSAGE_CODECS[
message_type].decoder(encoded_message)
# We turn off the default logging in protorpc. We may want to
# remove this later.
old_level = logging.getLogger().level
logging.getLogger().setLevel(logging.ERROR)
try:
result = _DecodeCustomFieldNames(message_type, encoded_message)
result = super(_ProtoJsonApiTools, self).decode_message(
message_type, result)
finally:
logging.getLogger().setLevel(old_level)
result = _DecodeCustomFieldNames(message_type, encoded_message)
result = super(_ProtoJsonApiTools, self).decode_message(
message_type, result)
result = _ProcessUnknownEnums(result, encoded_message)
result = _ProcessUnknownMessages(result, encoded_message)
return _DecodeUnknownFields(result, encoded_message)
Expand Down

0 comments on commit 3334d39

Please sign in to comment.