Skip to content

Commit

Permalink
Impedance matching: JSON severity names vs. protobuf numbers.
Browse files Browse the repository at this point in the history
  • Loading branch information
tseaver committed Jul 1, 2016
1 parent d662dd9 commit ac6bd5c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion gcloud/logging/_gax.py
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ def _log_entry_pb_to_mapping(entry_pb):
mapping = {
'logName': entry_pb.log_name,
'resource': _mon_resource_pb_to_mapping(entry_pb.resource),
'severity': entry_pb.severity,
'severity': LogSeverity.Name(entry_pb.severity),
'insertId': entry_pb.insert_id,
'timestamp': _pb_timestamp_to_rfc3339(entry_pb.timestamp),
'labels': entry_pb.labels,
Expand Down
5 changes: 3 additions & 2 deletions gcloud/logging/test__gax.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ def test_list_entries_with_paging(self):

def test_list_entries_with_extra_properties(self):
from datetime import datetime
from google.logging.type.log_severity_pb2 import WARNING
from gcloud._testing import _GAXPageIterator
from gcloud._helpers import UTC
from gcloud._helpers import _datetime_to_rfc3339
Expand All @@ -129,7 +130,7 @@ def test_list_entries_with_extra_properties(self):
request = _HTTPRequestPB()
operation = _LogEntryOperationPB()
EXTRAS = {
'severity': SEVERITY,
'severity': WARNING,
'labels': LABELS,
'insert_id': IID,
'http_request': request,
Expand Down Expand Up @@ -1054,7 +1055,7 @@ def __init__(self, fields):

class _LogEntryPB(object):

severity = 'DEFAULT'
severity = 0
http_request = operation = insert_id = None
text_payload = json_payload = proto_payload = None

Expand Down

0 comments on commit ac6bd5c

Please sign in to comment.