From 10314887135beb72aa6468482ffba61771993a81 Mon Sep 17 00:00:00 2001 From: rgoliver Date: Wed, 29 Jun 2022 09:49:34 -0400 Subject: [PATCH] RPC: Support pw logging for linux rpc examples (#20057) Add a config option CHIP_USE_PW_LOGGING, which uses pw log output instead of printf on linux. This allows the logs to correctly get HDLC encoded and be piped over the socket for linux RPC builds. --- examples/chef/linux/with_pw_rpc.gni | 1 + .../rpc_console/py/chip_rpc/console.py | 8 +++-- examples/lighting-app/linux/with_pw_rpc.gni | 1 + src/lib/core/BUILD.gn | 1 + src/lib/core/core.gni | 3 ++ src/platform/Linux/BUILD.gn | 9 ++++++ src/platform/Linux/Logging.cpp | 31 +++++++++++++++++++ 7 files changed, 52 insertions(+), 2 deletions(-) diff --git a/examples/chef/linux/with_pw_rpc.gni b/examples/chef/linux/with_pw_rpc.gni index 9533565ecf4ce8..416733753a8909 100644 --- a/examples/chef/linux/with_pw_rpc.gni +++ b/examples/chef/linux/with_pw_rpc.gni @@ -40,3 +40,4 @@ pw_build_LINK_DEPS = [ chip_enable_pw_rpc = true chip_build_pw_trace_lib = true +chip_use_pw_logging = true diff --git a/examples/common/pigweed/rpc_console/py/chip_rpc/console.py b/examples/common/pigweed/rpc_console/py/chip_rpc/console.py index 65fdfc034f60ab..c74b6617396e59 100644 --- a/examples/common/pigweed/rpc_console/py/chip_rpc/console.py +++ b/examples/common/pigweed/rpc_console/py/chip_rpc/console.py @@ -253,7 +253,8 @@ def write_to_output(data: bytes, "E": logging.ERROR, "F": logging.FATAL, "V": logging.DEBUG, "D": logging.DEBUG, "": logging.INFO, "": logging.DEBUG, "": logging.ERROR, "": logging.INFO, "": logging.WARNING, - "": logging.ERROR, "": logging.DEBUG} + "": logging.ERROR, "": logging.DEBUG, + "ERR": logging.ERROR, "DBG": logging.DEBUG, "INF": logging.INFO} ESP_CHIP_REGEX = r"(?P[IWEFV]) \((?P