14
14
"httpRequest" ,
15
15
"rpcName" ,
16
16
"serviceName" ,
17
+ "credentialsType" ,
18
+ "credentialInfo" ,
19
+ "universeDomain" ,
20
+ "request" ,
21
+ "response" ,
22
+ "metadata" ,
23
+ "retryAttempt" ,
17
24
]# Additional fields to be Logged.
18
25
19
26
20
- # TODO(https://github.com/googleapis/python-api-core/issues/763): Expand documentation.
21
- def logger_configured (logger ):
27
+ def logger_configured (logger )-> bool :
22
28
"""Determines whether `logger` has non-default configuration
23
29
24
30
Args:
@@ -32,7 +38,6 @@ def logger_configured(logger):
32
38
)
33
39
34
40
35
- # TODO(https://github.com/googleapis/python-api-core/issues/763): Expand documentation.
36
41
def initialize_logging ():
37
42
"""Initializes "google" loggers, partly based on the environment variable
38
43
@@ -55,7 +60,6 @@ def initialize_logging():
55
60
_LOGGING_INITIALIZED = True
56
61
57
62
58
- # TODO(https://github.com/googleapis/python-api-core/issues/763): Expand documentation.
59
63
def parse_logging_scopes (scopes :Optional [str ]= None )-> List [str ]:
60
64
"""Returns a list of logger names.
61
65
@@ -76,7 +80,6 @@ def parse_logging_scopes(scopes: Optional[str] = None) -> List[str]:
76
80
return namespaces
77
81
78
82
79
- # TODO(https://github.com/googleapis/python-api-core/issues/763): Expand documentation.
80
83
def configure_defaults (logger ):
81
84
"""Configures `logger` to emit structured info to stdout."""
82
85
if not logger_configured (logger ):
@@ -88,8 +91,7 @@ def configure_defaults(logger):
88
91
logger .addHandler (console_handler )
89
92
90
93
91
- # TODO(https://github.com/googleapis/python-api-core/issues/763): Expand documentation.
92
- def setup_logging (scopes = "" ):
94
+ def setup_logging (scopes :str = "" ):
93
95
"""Sets up logging for the specified `scopes`.
94
96
95
97
If the loggers specified in `scopes` have not been previously
@@ -122,11 +124,11 @@ def setup_logging(scopes=""):
122
124
base_logger .propagate = False
123
125
124
126
125
- # TODO(https://github.com/googleapis/python-api-core/issues/763):Add documentation.
127
+ # TODO(https://github.com/googleapis/python-api-core/issues/763):Expand documentation.
126
128
class StructuredLogFormatter (logging .Formatter ):
127
129
# TODO(https://github.com/googleapis/python-api-core/issues/761): ensure that additional fields such as
128
130
# function name, file name, and line no. appear in a log output.
129
- def format (self ,record ):
131
+ def format (self ,record : logging . LogRecord ):
130
132
log_obj = {
131
133
"timestamp" :self .formatTime (record ),
132
134
"severity" :record .levelname ,