Skip to content

Commit 50695e1

Browse files
committed
fix: timestamp (ms) can be 1 to 3 digits
The docs say the format is `HH:mm:ss.SSS`, but leading zeros in the milliseconds part are apparently stripped off. https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_debugging_debug_log.htm
1 parent 6fc4964 commit 50695e1

File tree

3 files changed

+32
-1
lines changed

3 files changed

+32
-1
lines changed

cli.bats

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,17 @@ setup() {
2222
}
2323
}
2424

25+
@test "one-digit-milliseconds" {
26+
cat fixtures/one-digit-milliseconds.txt | {
27+
run ./cli.js
28+
[ "$status" -eq 0 ]
29+
[ "${lines[0]}" = "debug-one" ]
30+
[ "${lines[1]}" = "debug-two" ]
31+
[ "${lines[2]}" = "debug-three" ]
32+
[ "${#lines[@]}" = "3" ]
33+
}
34+
}
35+
2536
@test "multiple-logs-multiple-lines" {
2637
cat fixtures/multiple-logs-multiple-lines.txt | {
2738
run ./cli.js

fixtures/one-digit-milliseconds.txt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
04:25:21.1 (22596799)|USER_DEBUG|[1]|DEBUG|debug-one
2+
04:25:21.10 (22596799)|USER_DEBUG|[1]|DEBUG|debug-two
3+
04:25:21.100 (22596799)|USER_DEBUG|[1]|DEBUG|debug-three
4+
08:57:44.10 (1001463193)|CUMULATIVE_LIMIT_USAGE
5+
08:57:44.100 (1001463193)|LIMIT_USAGE_FOR_NS|(default)|
6+
Number of SOQL queries: 22 out of 100
7+
Number of query rows: 22 out of 50000
8+
Number of SOSL queries: 0 out of 20
9+
Number of DML statements: 0 out of 150
10+
Number of Publish Immediate DML: 0 out of 150
11+
Number of DML rows: 0 out of 10000
12+
Maximum CPU time: 0 out of 10000
13+
Maximum heap size: 0 out of 6000000
14+
Number of callouts: 0 out of 100
15+
Number of Email Invocations: 0 out of 10
16+
Number of future calls: 0 out of 50
17+
Number of queueable jobs added to the queue: 0 out of 50
18+
Number of Mobile Apex push calls: 0 out of 10
19+
20+
08:57:44.1 (1001463193)|CUMULATIVE_LIMIT_USAGE_END

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const regex =
2-
/(.*USER_DEBUG(\|[^\|]*){2}\|)((.|\n)+?)((\n[\d]{2}:[\d]{2}:[\d]{2}\.[\d]{2}|$))/g;
2+
/(.*USER_DEBUG(\|[^\|]*){2}\|)((.|\n)+?)((\n[\d]{2}:[\d]{2}:[\d]{2}\.[\d]{1,3}|$))/g;
33

44
export function filterApexLogs(input) {
55
let output = "";

0 commit comments

Comments
 (0)