forked from platformio/platformio-core
Store device monitor logs in the project "logs" directory // Resolve #4596
This commit is contained in:
@ -17,6 +17,7 @@ PlatformIO Core 6
|
|||||||
6.1.7 (2023-??-??)
|
6.1.7 (2023-??-??)
|
||||||
~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
* Implemented a new feature to store device monitor logs in the project's "logs" folder, making it easier to access and review device monitor logs for your projects (`issue #4596 <https://github.com/platformio/platformio-core/issues/4596>`_)
|
||||||
* Improved source file filtering functionality for the `Static Code Analysis <https://docs.platformio.org/en/latest/advanced/static-code-analysis/index.html>`__ feature, making it easier to analyze only the code you need to
|
* Improved source file filtering functionality for the `Static Code Analysis <https://docs.platformio.org/en/latest/advanced/static-code-analysis/index.html>`__ feature, making it easier to analyze only the code you need to
|
||||||
* Added the ability to show a detailed library dependency tree only in `verbose mode <https://docs.platformio.org/en/latest/core/userguide/cmd_run.html#cmdoption-pio-run-v>`__, which can help you understand the relationship between libraries and troubleshoot issues more effectively (`issue #4517 <https://github.com/platformio/platformio-core/issues/4517>`_)
|
* Added the ability to show a detailed library dependency tree only in `verbose mode <https://docs.platformio.org/en/latest/core/userguide/cmd_run.html#cmdoption-pio-run-v>`__, which can help you understand the relationship between libraries and troubleshoot issues more effectively (`issue #4517 <https://github.com/platformio/platformio-core/issues/4517>`_)
|
||||||
* Added the ability to run only the `device monitor <https://docs.platformio.org/en/latest/core/userguide/device/cmd_monitor.html>`__ when using the `pio run -t monitor <https://docs.platformio.org/en/latest/core/userguide/cmd_run.html>`__ command, saving you time and resources by skipping the build process
|
* Added the ability to run only the `device monitor <https://docs.platformio.org/en/latest/core/userguide/device/cmd_monitor.html>`__ when using the `pio run -t monitor <https://docs.platformio.org/en/latest/core/userguide/cmd_run.html>`__ command, saving you time and resources by skipping the build process
|
||||||
|
2
docs
2
docs
Submodule docs updated: e3c5bb8597...2c2cc23f42
@ -132,24 +132,24 @@ def device_monitor_cmd(**options):
|
|||||||
ensure_ready=True,
|
ensure_ready=True,
|
||||||
).find(initial_port=options["port"])
|
).find(initial_port=options["port"])
|
||||||
|
|
||||||
if options["menu_char"] == options["exit_char"]:
|
if options["menu_char"] == options["exit_char"]:
|
||||||
raise exception.UserSideException(
|
raise exception.UserSideException(
|
||||||
"--exit-char can not be the same as --menu-char"
|
"--exit-char can not be the same as --menu-char"
|
||||||
)
|
|
||||||
|
|
||||||
# check for unknown filters
|
|
||||||
if options["filters"]:
|
|
||||||
known_filters = set(get_available_filters())
|
|
||||||
unknown_filters = set(options["filters"]) - known_filters
|
|
||||||
if unknown_filters:
|
|
||||||
options["filters"] = list(known_filters & set(options["filters"]))
|
|
||||||
click.secho(
|
|
||||||
("Warning! Skipping unknown filters `%s`. Known filters are `%s`")
|
|
||||||
% (", ".join(unknown_filters), ", ".join(sorted(known_filters))),
|
|
||||||
fg="yellow",
|
|
||||||
)
|
)
|
||||||
|
|
||||||
start_terminal(options)
|
# check for unknown filters
|
||||||
|
if options["filters"]:
|
||||||
|
known_filters = set(get_available_filters())
|
||||||
|
unknown_filters = set(options["filters"]) - known_filters
|
||||||
|
if unknown_filters:
|
||||||
|
options["filters"] = list(known_filters & set(options["filters"]))
|
||||||
|
click.secho(
|
||||||
|
("Warning! Skipping unknown filters `%s`. Known filters are `%s`")
|
||||||
|
% (", ".join(unknown_filters), ", ".join(sorted(known_filters))),
|
||||||
|
fg="yellow",
|
||||||
|
)
|
||||||
|
|
||||||
|
start_terminal(options)
|
||||||
|
|
||||||
|
|
||||||
def get_project_options(environment=None):
|
def get_project_options(environment=None):
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
import io
|
import io
|
||||||
import os.path
|
import os
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
from platformio.device.monitor.filters.base import DeviceMonitorFilterBase
|
from platformio.device.monitor.filters.base import DeviceMonitorFilterBase
|
||||||
@ -27,8 +27,10 @@ class LogToFile(DeviceMonitorFilterBase):
|
|||||||
self._log_fp = None
|
self._log_fp = None
|
||||||
|
|
||||||
def __call__(self):
|
def __call__(self):
|
||||||
log_file_name = "platformio-device-monitor-%s.log" % datetime.now().strftime(
|
if not os.path.isdir("logs"):
|
||||||
"%y%m%d-%H%M%S"
|
os.makedirs("logs")
|
||||||
|
log_file_name = os.path.join(
|
||||||
|
"logs", "device-monitor-%s.log" % datetime.now().strftime("%y%m%d-%H%M%S")
|
||||||
)
|
)
|
||||||
print("--- Logging an output to %s" % os.path.abspath(log_file_name))
|
print("--- Logging an output to %s" % os.path.abspath(log_file_name))
|
||||||
# pylint: disable=consider-using-with
|
# pylint: disable=consider-using-with
|
||||||
|
Reference in New Issue
Block a user