pw_console: Serial bytes logging

- Move pw_console python logging related functions to python_logging.py

- Add a PwConsoleEmbed.setup_python_logging to:
  - Silence debug messages from prompt_toolkit and asyncio.
  - Disable all Stdout and Stderr handlers.

- log_line.py and table.py:
  Strip trailing white space to prevent extra line breaks showing up in
  the log window.

- pw_console/py/pw_console/pyserial_wrapper.py
  - SerialWithLogging class that wrapps read and write to add logging
  - Logs with metadata columns (byte length and Read/Write) and hex
    numbers aligned with characters.

- pw_hdlc/py/pw_hdlc/rpc_console.py:
  - Add two additional log panes for serial debug and host log messages
    (hidden by default).
  - New --serial-debug to turn on SerialWithLogging

Bug: 403
Test: openocd -f targets/stm32f429i_disc1/py/stm32f429i_disc1_utils/openocd_stm32f4xx.cfg -c "program out/stm32f429i_disc1_debug/obj/pw_hdlc/rpc_example/bin/rpc_example.elf verify reset exit"
Test: pw rpc -d /dev/ttyACM0 -b 115200 --proto-globs pw_rpc/echo.proto
Change-Id: I579d93eb77dea0825c21d91ff2251080bac2186d
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/56784
Reviewed-by: Keir Mierle <keir@google.com>
Reviewed-by: Armando Montanez <amontanez@google.com>
Commit-Queue: Anthony DiGirolamo <tonymd@google.com>
12 files changed
tree: e427836ad7512ea0ad29c5b94e3086aba4f52dce
  1. build_overrides/
  2. docker/
  3. docs/
  4. pw_allocator/
  5. pw_analog/
  6. pw_android_toolchain/
  7. pw_arduino_build/
  8. pw_assert/
  9. pw_assert_basic/
  10. pw_assert_log/
  11. pw_base64/
  12. pw_bloat/
  13. pw_blob_store/
  14. pw_bluetooth_hci/
  15. pw_boot/
  16. pw_boot_cortex_m/
  17. pw_build/
  18. pw_build_info/
  19. pw_bytes/
  20. pw_checksum/
  21. pw_chrono/
  22. pw_chrono_embos/
  23. pw_chrono_freertos/
  24. pw_chrono_stl/
  25. pw_chrono_threadx/
  26. pw_cli/
  27. pw_console/
  28. pw_containers/
  29. pw_cpu_exception/
  30. pw_cpu_exception_cortex_m/
  31. pw_crypto/
  32. pw_docgen/
  33. pw_doctor/
  34. pw_env_setup/
  35. pw_file/
  36. pw_function/
  37. pw_fuzzer/
  38. pw_hdlc/
  39. pw_hex_dump/
  40. pw_i2c/
  41. pw_interrupt/
  42. pw_interrupt_cortex_m/
  43. pw_kvs/
  44. pw_libc/
  45. pw_log/
  46. pw_log_basic/
  47. pw_log_null/
  48. pw_log_rpc/
  49. pw_log_tokenized/
  50. pw_malloc/
  51. pw_malloc_freelist/
  52. pw_metric/
  53. pw_minimal_cpp_stdlib/
  54. pw_module/
  55. pw_multisink/
  56. pw_package/
  57. pw_persistent_ram/
  58. pw_polyfill/
  59. pw_preprocessor/
  60. pw_presubmit/
  61. pw_protobuf/
  62. pw_protobuf_compiler/
  63. pw_random/
  64. pw_result/
  65. pw_ring_buffer/
  66. pw_router/
  67. pw_rpc/
  68. pw_snapshot/
  69. pw_software_update/
  70. pw_span/
  71. pw_status/
  72. pw_stm32cube_build/
  73. pw_stream/
  74. pw_string/
  75. pw_symbolizer/
  76. pw_sync/
  77. pw_sync_baremetal/
  78. pw_sync_embos/
  79. pw_sync_freertos/
  80. pw_sync_stl/
  81. pw_sync_threadx/
  82. pw_sys_io/
  83. pw_sys_io_arduino/
  84. pw_sys_io_baremetal_lm3s6965evb/
  85. pw_sys_io_baremetal_stm32f429/
  86. pw_sys_io_stdio/
  87. pw_target_runner/
  88. pw_thread/
  89. pw_thread_embos/
  90. pw_thread_freertos/
  91. pw_thread_stl/
  92. pw_thread_threadx/
  93. pw_tls_client/
  94. pw_tls_client_boringssl/
  95. pw_tls_client_mbedtls/
  96. pw_tokenizer/
  97. pw_tool/
  98. pw_toolchain/
  99. pw_trace/
  100. pw_trace_tokenized/
  101. pw_transfer/
  102. pw_unit_test/
  103. pw_varint/
  104. pw_watch/
  105. pw_web_ui/
  106. pw_work_queue/
  107. targets/
  108. third_party/
  109. .bazelignore
  110. .bazelrc
  111. .clang-format
  112. .clang-tidy
  113. .eslintrc.json
  114. .gitattributes
  115. .gitignore
  116. .gn
  117. .prettierrc.js
  118. .pylintrc
  119. activate.bat
  120. AUTHORS
  121. bootstrap.bat
  122. bootstrap.sh
  123. BUILD.bazel
  124. BUILD.gn
  125. BUILDCONFIG.gn
  126. CMakeLists.txt
  127. LICENSE
  128. modules.gni
  129. OWNERS
  130. package.json
  131. PW_PLUGINS
  132. README.md
  133. tsconfig.json
  134. WORKSPACE
  135. yarn.lock
README.md

Pigweed

Pigweed is an open source collection of embedded-targeted libraries–or as we like to call them, modules. These modules are building blocks and infrastructure that enable faster and more reliable development on small-footprint MMU-less 32-bit microcontrollers like the STMicroelectronics STM32L452 or the Nordic nRF52832.

For more information please see our website: https://pigweed.dev/

Links