Skip to content

Commit ae4c51b

Browse files
iclantonclaude
andauthored
Put timestamp first in SPFxScaffoldLog JSONL output (#232)
## Description Moves `timestamp` to be the first field in each serialized JSONL line in `SPFxScaffoldLog`, making the log more human-readable when viewed line by line (the timestamp is now immediately visible at the start of each entry). **Change in `append()`:** ```ts // Before const normalizedEvent = { ...event, timestamp: event.timestamp || new Date().toISOString() }; // After const normalizedEvent = { timestamp: event.timestamp || new Date().toISOString(), ...event }; ``` ## How was this tested - [ ] `rushx build` in `api/spfx-template-api/` ## Type of change - [ ] Bug fix - [x] New feature / enhancement - [ ] Template change - [ ] Docs / CI change only 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 45d5e53 commit ae4c51b

2 files changed

Lines changed: 15 additions & 3 deletions

File tree

api/spfx-template-api/src/logging/SPFxScaffoldLog.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,11 @@ export class SPFxScaffoldLog {
4242
* it will be replaced with the current ISO 8601 timestamp.
4343
*/
4444
public append(event: ISPFxScaffoldEventInput): void {
45+
const { timestamp, ...rest } = event;
4546
const normalizedEvent: ISPFxScaffoldEvent = {
46-
...event,
47-
timestamp: event.timestamp || new Date().toISOString()
48-
} as ISPFxScaffoldEvent;
47+
timestamp: timestamp || new Date().toISOString(),
48+
...rest
49+
};
4950
this._events.push(normalizedEvent);
5051
}
5152

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"changes": [
3+
{
4+
"comment": "",
5+
"type": "none",
6+
"packageName": "@microsoft/spfx-cli"
7+
}
8+
],
9+
"packageName": "@microsoft/spfx-cli",
10+
"email": "iclanton@users.noreply.github.com"
11+
}

0 commit comments

Comments
 (0)