From 590401735bb6a9d21daf54f4a2405c183a7a53d8 Mon Sep 17 00:00:00 2001 From: Trim21 Date: Sat, 21 Sep 2024 05:12:39 +0800 Subject: [PATCH] improve logger --- start_grpc_server.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/start_grpc_server.py b/start_grpc_server.py index b10020e..a2e5c0e 100644 --- a/start_grpc_server.py +++ b/start_grpc_server.py @@ -7,6 +7,7 @@ import etcd3 import grpc +import sslog from etcd3 import Lease from etcd3.utils import retry from sslog import logger @@ -107,7 +108,13 @@ def main(): print("timeline micro service") sys.exit(0) logger.info("starting grpc server") - logging.basicConfig() + logging.basicConfig( + handlers=[ + sslog.InterceptHandler( + level=logging.NOTSET if config.debug else logging.INFO + ) + ] + ) start_server()