espressif / esp-idf-monitor

Apache License 2.0
23 stars 8 forks source link

File Save direct from the command line [feature request] (IDFGH-12786) #14

Open filzek opened 6 months ago

filzek commented 6 months ago

To enhance the usability and functionality of the idf.py monitor command, it would be beneficial to introduce a new option, --file, that facilitates simultaneous output to both the terminal and a specified log file. This feature is particularly useful for developers who need to analyze logs after running their application or during debugging sessions.

Proposed Feature Description Option: --file FILENAME Functionality: When the --file option is used with the idf.py monitor command, the tool should simultaneously display the output in the terminal and write it to the specified file. This dual-output approach allows developers to monitor their application in real-time while also maintaining a record for later analysis.

Example Usage:

idf.py -p PORT monitor --file xpto.txt

In this scenario:

-p PORT specifies the serial port where the ESP device is connected. --file xpto.txt directs the idf.py monitor tool to write the output to xpto.txt while also displaying it in the terminal. Benefits Convenience: Developers can track issues in real-time and have a persistent record without needing to redirect or pipe output manually. Efficiency: This feature saves time and reduces the complexity of development workflows, especially when diagnosing intermittent issues that require reviewing extended logs. Consistency: Having a standardized way to log monitor output ensures that developers can reliably capture and share logs across different systems and teams.

This way the CRTL + L could also be used, but the log can be done form the prompt call.

pcouderc12 commented 3 months ago

+1 and file name not mandatory, a default fixed like name lastlog.txt is enough...