-
Notifications
You must be signed in to change notification settings - Fork 242
Add option for printing timestamp before each line of Serial Monitor output #1430
Conversation
/azp run |
No pipelines are associated with this pull request. |
@@ -102,7 +105,7 @@ export class SerialPortCtrl { | |||
this._child.stdout.on("data", (data) => { | |||
if (this.isActive) { | |||
const jsonObj = JSON.parse(data.toString()) | |||
this._bufferedOutputChannel.append(jsonObj["payload"] + "\n"); | |||
this._bufferedOutputChannel.append(jsonObj["timestamp"] + jsonObj["payload"] + "\n"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One thing to consider here is forcing a certain "break" rather than allowing the user to set it. If there arises a scenario where the user wants to do something with the timestamp data, they might have trouble doing that along with formatting, since they'd have to parse out the extra characters.
i.e. Hard-code in the "->" and only let the user define the format of the time. This way they only get the time in the 'timestamp' json and they don't have to parse out the seperator characters. This would mean users only set '%H:%m:%s' for example, compared to now, where they can set '%H:%m:%s ->'
However, for how the extension currently uses it, what you have is fine and this comment won't block your PR.
/azp run |
No pipelines are associated with this pull request. |
Now you can print timestamp before each line of Serial Monitor output.
Format of timestamp can be changed using command "Arduino: Change Timestamp Format" (
arduino.changeTimestampFormat
).You can find list of all available placeholders here: https://strftime.org.
Example ("Timestamp Format" set to
%H:%M:%S.%f ->
):This PR adresses these issues:
Warning! This PR depends on microsoft/serial-monitor-cli#10
@benmcmorran or @gcampbell-msft, please, could you review?