third_party.pigweed.src/pw_console/py/BUILD.gn
Anthony DiGirolamo 427edb2eb7 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>
2021-10-06 21:33:35 +00:00

85 lines
2.5 KiB
Plaintext

# Copyright 2021 The Pigweed Authors
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.
import("//build_overrides/pigweed.gni")
import("$dir_pw_build/python.gni")
pw_python_package("py") {
setup = [
"pyproject.toml",
"setup.cfg",
"setup.py",
]
sources = [
"pw_console/__init__.py",
"pw_console/__main__.py",
"pw_console/console_app.py",
"pw_console/console_prefs.py",
"pw_console/embed.py",
"pw_console/filter_toolbar.py",
"pw_console/help_window.py",
"pw_console/key_bindings.py",
"pw_console/log_filter.py",
"pw_console/log_line.py",
"pw_console/log_pane.py",
"pw_console/log_pane_toolbars.py",
"pw_console/log_store.py",
"pw_console/log_view.py",
"pw_console/mouse.py",
"pw_console/pigweed_code_style.py",
"pw_console/progress_bar/__init__.py",
"pw_console/progress_bar/progress_bar_impl.py",
"pw_console/progress_bar/progress_bar_state.py",
"pw_console/progress_bar/progress_bar_task_counter.py",
"pw_console/pw_ptpython_repl.py",
"pw_console/pyserial_wrapper.py",
"pw_console/python_logging.py",
"pw_console/repl_pane.py",
"pw_console/search_toolbar.py",
"pw_console/style.py",
"pw_console/text_formatting.py",
"pw_console/widgets/__init__.py",
"pw_console/widgets/checkbox.py",
"pw_console/widgets/focus_on_click_overlay.py",
"pw_console/widgets/mouse_handlers.py",
"pw_console/widgets/table.py",
"pw_console/window_list.py",
"pw_console/window_manager.py",
]
tests = [
"console_app_test.py",
"console_prefs_test.py",
"help_window_test.py",
"log_filter_test.py",
"log_store_test.py",
"log_view_test.py",
"repl_pane_test.py",
"table_test.py",
"text_formatting_test.py",
"window_manager_test.py",
]
python_deps = [
"$dir_pw_cli/py",
"$dir_pw_log_tokenized/py",
"$dir_pw_tokenizer/py",
]
inputs = [
"pw_console/templates/keybind_list.jinja",
"pw_console/templates/repl_output.jinja",
]
pylintrc = "$dir_pigweed/.pylintrc"
}