Skip to content

Commit d2d9628

Browse files
committed
fix style
1 parent 38f62d9 commit d2d9628

File tree

3 files changed

+12
-29
lines changed

3 files changed

+12
-29
lines changed

logging/google/cloud/logging/handlers/app_engine.py

Lines changed: 11 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -23,49 +23,34 @@
2323
from google.cloud.logging.handlers.transports import BackgroundThreadTransport
2424
from google.cloud.logging.resource import Resource
2525

26+
_DEFAULT_GAE_LOGGER_NAME = 'app'
27+
2628
_GAE_PROJECT_ENV = 'GCLOUD_PROJECT'
2729
_GAE_SERVICE_ENV = 'GAE_SERVICE'
2830
_GAE_VERSION_ENV = 'GAE_VERSION'
2931

3032

3133
class AppEngineHandler(CloudLoggingHandler):
32-
"""A handler that directly makes Stackdriver logging API calls.
33-
34-
This handler can be used to route Python standard logging messages directly
35-
to the Stackdriver Logging API.
36-
37-
This handler supports both an asynchronous and synchronous transport.
34+
"""A logging handler that sends App Engine-formatted logs to Stackdriver.
3835
3936
:type client: :class:`google.cloud.logging.client`
4037
:param client: the authenticated Google Cloud Logging client for this
4138
handler to use
4239
43-
:type name: str
44-
:param name: the name of the custom log in Stackdriver Logging. Defaults
45-
to 'python'. The name of the Python logger will be represented
46-
in the ``python_logger`` field.
47-
4840
:type transport: type
49-
:param transport: Class for creating new transport objects. It should
50-
extend from the base :class:`.Transport` type and
51-
implement :meth`.Transport.send`. Defaults to
52-
:class:`.BackgroundThreadTransport`. The other
53-
option is :class:`.SyncTransport`.
54-
55-
:type resource: :class:`~google.cloud.logging.resource.Resource`
56-
:param resource: Monitored resource of the entry, defaults
57-
to the global resource type.
41+
:param transport: The transport class. It should be a subclass of :class:`.Transport`.
42+
If unspecified, :class:`.BackgroundThreadTransport` will be used.
5843
"""
5944

60-
DEFAULT_LOGGER_NAME = 'app'
61-
6245
def __init__(self, client,
6346
transport=BackgroundThreadTransport):
64-
super(AppEngineHandler, self).__init__(client, name=self.DEFAULT_LOGGER_NAME,
65-
transport=transport, resource=self.gae_resource)
47+
super(AppEngineHandler, self).__init__(
48+
client,
49+
name=_DEFAULT_GAE_LOGGER_NAME,
50+
transport=transport,
51+
resource=self.get_gae_resource())
6652

67-
@property
68-
def gae_resource(self):
53+
def get_gae_resource(self):
6954
gae_resource = Resource(
7055
type='gae_app',
7156
labels={

logging/google/cloud/logging/handlers/transports/sync.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
"""
1919

2020
from google.cloud.logging.handlers.transports.base import Transport
21-
from google.cloud.logging.resource import Resource
2221

2322

2423
class SyncTransport(Transport):

logging/tests/unit/handlers/test_app_engine.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717

1818

1919
class TestAppEngineHandlerHandler(unittest.TestCase):
20-
2120
PROJECT = 'PROJECT'
2221

2322
def _get_target_class(self):
@@ -47,7 +46,7 @@ def test_ctor(self):
4746
def test_emit(self):
4847
client = _Client(self.PROJECT)
4948
handler = self._make_one(client, transport=_Transport)
50-
gae_resource = handler.gae_resource
49+
gae_resource = handler.get_gae_resource()
5150
logname = 'loggername'
5251
message = 'hello world'
5352
record = logging.LogRecord(logname, logging, None, None, message,

0 commit comments

Comments
 (0)