Store device monitor logs in the project "logs" directory // Resolve #4596

This commit is contained in:
Ivan Kravets
2023-04-12 20:02:26 +03:00
parent 58a1d5d96e
commit 5c3ae15bee
4 changed files with 23 additions and 20 deletions

View File

@ -17,6 +17,7 @@ PlatformIO Core 6
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
* 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

2
docs

Submodule docs updated: e3c5bb8597...2c2cc23f42

View File

@ -13,7 +13,7 @@
# limitations under the License.
import io
import os.path
import os
from datetime import datetime
from platformio.device.monitor.filters.base import DeviceMonitorFilterBase
@ -27,8 +27,10 @@ class LogToFile(DeviceMonitorFilterBase):
self._log_fp = None
def __call__(self):
log_file_name = "platformio-device-monitor-%s.log" % datetime.now().strftime(
"%y%m%d-%H%M%S"
if not os.path.isdir("logs"):
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))
# pylint: disable=consider-using-with