Skip to content

Commit 8431da9

Browse files
committed
chore: Bump version to 0.2.1
1 parent b37997c commit 8431da9

File tree

3 files changed

+33
-31
lines changed

3 files changed

+33
-31
lines changed

google_cloud_logger/__init__.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,8 @@ def __init__(self, *args, **kwargs):
1919
def _get_extra_fields(self, record):
2020
if hasattr(record, "extra"):
2121
return record.extra
22-
attributes = (
23-
field for field in record.__dict__.keys() if not inspect.ismethod(field)
24-
)
22+
attributes = (field for field in record.__dict__.keys()
23+
if not inspect.ismethod(field))
2524

2625
fields = set(attributes).difference(set(self.reserved_attrs.keys()))
2726
return {key: getattr(record, key) for key in fields if key}

setup.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
with open("README.md", "r") as output:
44
long_description = output.read()
55

6-
7-
__VERSION__ = "0.2.0"
6+
__VERSION__ = "0.2.1"
87

98
setup(
109
name="google_cloud_logger",
@@ -18,15 +17,11 @@
1817
license="MIT",
1918
packages=find_packages(),
2019
python_requires=">=3.4.*",
21-
install_requires=[
22-
"python-json-logger>=0.1.10"
23-
],
20+
install_requires=["python-json-logger>=0.1.10"],
2421
classifiers=[
25-
"Environment :: Web Environment",
26-
"Intended Audience :: Developers",
22+
"Environment :: Web Environment", "Intended Audience :: Developers",
2723
"License :: OSI Approved :: MIT License",
28-
"Natural Language :: English",
29-
"Operating System :: OS Independent",
24+
"Natural Language :: English", "Operating System :: OS Independent",
3025
"Programming Language :: Python :: 3 :: Only",
3126
"Topic :: System :: Logging"
3227
],

test/google_cloud_logger/test_google_cloud_formatter.py

Lines changed: 27 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import pytest
44
from google_cloud_logger import GoogleCloudFormatter
55

6+
67
# from https://stackoverflow.com/a/19258720
78
class FakeCode(object):
89
def __init__(self, co_filename, co_name):
@@ -64,7 +65,9 @@ def record_with_extra_attribute(log_record_factory, mocker):
6465
"lineno": "88",
6566
"levelname": "WARNING",
6667
"message": "farofa",
67-
"extra": {"extra_field": "extra"},
68+
"extra": {
69+
"extra_field": "extra"
70+
},
6871
}
6972
record = log_record_factory(**data)
7073
record.getMessage = mocker.Mock(return_value=data["message"])
@@ -95,19 +98,25 @@ def test_add_fields(formatter, record, mocker):
9598
mocker.patch.object(
9699
formatter,
97100
"make_entry",
98-
return_value=OrderedDict(
99-
[
100-
("timestamp", "2018-08-30 20:40:57Z"),
101-
("severity", "WARNING"),
102-
("message", "farofa"),
103-
("labels", {"type": "python-application"}),
104-
("metadata", {"userLabels": {}}),
105-
(
106-
"sourceLocation",
107-
{"file": "_internal.py", "function": "_log", "line": "88"},
108-
),
109-
]
110-
),
101+
return_value=OrderedDict([
102+
("timestamp", "2018-08-30 20:40:57Z"),
103+
("severity", "WARNING"),
104+
("message", "farofa"),
105+
("labels", {
106+
"type": "python-application"
107+
}),
108+
("metadata", {
109+
"userLabels": {}
110+
}),
111+
(
112+
"sourceLocation",
113+
{
114+
"file": "_internal.py",
115+
"function": "_log",
116+
"line": "88"
117+
},
118+
),
119+
]),
111120
)
112121
formatter.add_fields(log_record, record, {})
113122

@@ -141,7 +150,8 @@ def test_make_metadata(formatter, record):
141150
assert metadata["userLabels"]["extra_field"] == "extra"
142151

143152

144-
def test_make_metadata_with_extra_attribute(formatter, record_with_extra_attribute):
153+
def test_make_metadata_with_extra_attribute(formatter,
154+
record_with_extra_attribute):
145155
metadata = formatter.make_metadata(record_with_extra_attribute)
146156

147157
assert metadata["userLabels"]["extra_field"] == "extra"
@@ -166,10 +176,8 @@ def test_make_source_location(formatter, record):
166176

167177

168178
def test_format_timestamp(formatter):
169-
assert (
170-
formatter.format_timestamp("2018-08-30 20:40:57,245")
171-
== "2018-08-30T20:40:57.245000Z"
172-
)
179+
assert (formatter.format_timestamp("2018-08-30 20:40:57,245") ==
180+
"2018-08-30T20:40:57.245000Z")
173181

174182

175183
@pytest.mark.parametrize(

0 commit comments

Comments
 (0)