aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/python/grpcio_testing/grpc_testing/_time.py
diff options
context:
space:
mode:
authorGravatar Naresh <ghostwriternr@gmail.com>2018-03-01 13:24:45 +0530
committerGravatar Naresh <ghostwriternr@gmail.com>2018-05-31 08:08:25 +0000
commit2e113ca6b2cc31aa8a9687d40ee1bd759381654f (patch)
tree1400589a34a636698e6ed175d5e83b4d7b593bb2 /src/python/grpcio_testing/grpc_testing/_time.py
parentc4bc06be8b654accd19e58ef4f97a6ac3a480914 (diff)
Update logging in Python to use module-level logger
All logging in Python so far was done with the root logger, resulting in logs like: `ERROR:Exception calling application:`. With module-level loggers, the logs will instead include the module in which the exception is raised: `ERROR:grpc._server:Exception calling application:`
Diffstat (limited to 'src/python/grpcio_testing/grpc_testing/_time.py')
-rw-r--r--src/python/grpcio_testing/grpc_testing/_time.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/python/grpcio_testing/grpc_testing/_time.py b/src/python/grpcio_testing/grpc_testing/_time.py
index afbdad3524..75e6db3458 100644
--- a/src/python/grpcio_testing/grpc_testing/_time.py
+++ b/src/python/grpcio_testing/grpc_testing/_time.py
@@ -21,13 +21,15 @@ import time as _time
import grpc
import grpc_testing
+_LOGGER = logging.getLogger(__name__)
+
def _call(behaviors):
for behavior in behaviors:
try:
behavior()
except Exception: # pylint: disable=broad-except
- logging.exception('Exception calling behavior "%r"!', behavior)
+ _LOGGER.exception('Exception calling behavior "%r"!', behavior)
def _call_in_thread(behaviors):