Эх сурвалжийг харах

Merge pull request #17322 from lidizheng/py-example-logging

Add logging.basicConfig() for example servers
Lidi Zheng 6 жил өмнө
parent
commit
0c5d196dbc

+ 2 - 0
examples/python/helloworld/greeter_client.py

@@ -14,6 +14,7 @@
 """The Python implementation of the GRPC helloworld.Greeter client."""
 """The Python implementation of the GRPC helloworld.Greeter client."""
 
 
 from __future__ import print_function
 from __future__ import print_function
+import logging
 
 
 import grpc
 import grpc
 
 
@@ -32,4 +33,5 @@ def run():
 
 
 
 
 if __name__ == '__main__':
 if __name__ == '__main__':
+    logging.basicConfig()
     run()
     run()

+ 2 - 0
examples/python/helloworld/greeter_client_with_options.py

@@ -14,6 +14,7 @@
 """The Python implementation of the GRPC helloworld.Greeter client with channel options and call timeout parameters."""
 """The Python implementation of the GRPC helloworld.Greeter client with channel options and call timeout parameters."""
 
 
 from __future__ import print_function
 from __future__ import print_function
+import logging
 
 
 import grpc
 import grpc
 
 
@@ -41,4 +42,5 @@ def run():
 
 
 
 
 if __name__ == '__main__':
 if __name__ == '__main__':
+    logging.basicConfig()
     run()
     run()

+ 2 - 0
examples/python/helloworld/greeter_server.py

@@ -15,6 +15,7 @@
 
 
 from concurrent import futures
 from concurrent import futures
 import time
 import time
+import logging
 
 
 import grpc
 import grpc
 
 
@@ -43,4 +44,5 @@ def serve():
 
 
 
 
 if __name__ == '__main__':
 if __name__ == '__main__':
+    logging.basicConfig()
     serve()
     serve()

+ 2 - 0
examples/python/helloworld/greeter_server_with_reflection.py

@@ -15,6 +15,7 @@
 
 
 from concurrent import futures
 from concurrent import futures
 import time
 import time
+import logging
 
 
 import grpc
 import grpc
 from grpc_reflection.v1alpha import reflection
 from grpc_reflection.v1alpha import reflection
@@ -49,4 +50,5 @@ def serve():
 
 
 
 
 if __name__ == '__main__':
 if __name__ == '__main__':
+    logging.basicConfig()
     serve()
     serve()

+ 2 - 0
examples/python/interceptors/default_value/greeter_client.py

@@ -14,6 +14,7 @@
 """The Python implementation of the gRPC helloworld.Greeter client."""
 """The Python implementation of the gRPC helloworld.Greeter client."""
 
 
 from __future__ import print_function
 from __future__ import print_function
+import logging
 
 
 import grpc
 import grpc
 
 
@@ -39,4 +40,5 @@ def run():
 
 
 
 
 if __name__ == '__main__':
 if __name__ == '__main__':
+    logging.basicConfig()
     run()
     run()

+ 2 - 0
examples/python/interceptors/headers/greeter_client.py

@@ -14,6 +14,7 @@
 """The Python implementation of the GRPC helloworld.Greeter client."""
 """The Python implementation of the GRPC helloworld.Greeter client."""
 
 
 from __future__ import print_function
 from __future__ import print_function
+import logging
 
 
 import grpc
 import grpc
 
 
@@ -37,4 +38,5 @@ def run():
 
 
 
 
 if __name__ == '__main__':
 if __name__ == '__main__':
+    logging.basicConfig()
     run()
     run()

+ 2 - 0
examples/python/interceptors/headers/greeter_server.py

@@ -15,6 +15,7 @@
 
 
 from concurrent import futures
 from concurrent import futures
 import time
 import time
+import logging
 
 
 import grpc
 import grpc
 
 
@@ -49,4 +50,5 @@ def serve():
 
 
 
 
 if __name__ == '__main__':
 if __name__ == '__main__':
+    logging.basicConfig()
     serve()
     serve()

+ 2 - 0
examples/python/multiplex/multiplex_client.py

@@ -17,6 +17,7 @@ from __future__ import print_function
 
 
 import random
 import random
 import time
 import time
+import logging
 
 
 import grpc
 import grpc
 
 
@@ -126,4 +127,5 @@ def run():
 
 
 
 
 if __name__ == '__main__':
 if __name__ == '__main__':
+    logging.basicConfig()
     run()
     run()

+ 2 - 0
examples/python/multiplex/multiplex_server.py

@@ -16,6 +16,7 @@
 from concurrent import futures
 from concurrent import futures
 import time
 import time
 import math
 import math
+import logging
 
 
 import grpc
 import grpc
 
 
@@ -136,4 +137,5 @@ def serve():
 
 
 
 
 if __name__ == '__main__':
 if __name__ == '__main__':
+    logging.basicConfig()
     serve()
     serve()

+ 2 - 0
examples/python/route_guide/route_guide_client.py

@@ -16,6 +16,7 @@
 from __future__ import print_function
 from __future__ import print_function
 
 
 import random
 import random
+import logging
 
 
 import grpc
 import grpc
 
 
@@ -116,4 +117,5 @@ def run():
 
 
 
 
 if __name__ == '__main__':
 if __name__ == '__main__':
+    logging.basicConfig()
     run()
     run()

+ 2 - 0
examples/python/route_guide/route_guide_server.py

@@ -16,6 +16,7 @@
 from concurrent import futures
 from concurrent import futures
 import time
 import time
 import math
 import math
+import logging
 
 
 import grpc
 import grpc
 
 
@@ -126,4 +127,5 @@ def serve():
 
 
 
 
 if __name__ == '__main__':
 if __name__ == '__main__':
+    logging.basicConfig()
     serve()
     serve()