Skip to content

Commit fbd1729

Browse files
committed
feat: add 49 new Salesforce debug log event types and fix event metadata
Add support for 49 previously unrecognised debug log events sourced from the Salesforce Debug Level page, including cursor operations, formula evaluation, RLM configurator/pricing, org/session cache, policy rules, data access evaluation, and additional flow/workflow events. - Add LOG_LEVEL constant and LogLevel type to types.ts - Add DataAccess and Wave to DEBUG_CATEGORY - Populate debugLevel and debugCategory on all event classes per official Salesforce documentation - Fix category mismatches (e.g. VF_SERIALIZE_VIEWSTATE_BEGIN was ApexCode, should be Visualforce; USER_DEBUG was ApexProfiling, should be ApexCode) - Create DurationLogEvent classes for begin/end pairs: CursorCreateBegin, FormulaEvaluateBegin, RlmConfiguratorBegin, RlmPricingBegin - Remove duplicate entries from _logEventNames - Sort all event arrays alphabetically - Add EventMetadata test suite
1 parent fb4587b commit fbd1729

5 files changed

Lines changed: 868 additions & 638 deletions

File tree

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
/*
2+
* Copyright (c) 2026 Certinia Inc. All rights reserved.
3+
*/
4+
import { getLogEventClass, parse } from '../src/index.js';
5+
6+
describe('Event debugLevel and debugCategory', () => {
7+
describe('new events are parsed (not null from getLogEventClass)', () => {
8+
const newEvents = [
9+
'APP_ANALYTICS_ERROR',
10+
'APP_ANALYTICS_FINE',
11+
'APP_ANALYTICS_WARN',
12+
'CURSOR_CREATE_BEGIN',
13+
'CURSOR_CREATE_END',
14+
'CURSOR_FETCH',
15+
'CURSOR_FETCH_PAGE',
16+
'DATA_ACCESS_EVALUATION',
17+
'DUPLICATE_RULE_FILTER_INVOCATION',
18+
'END_CALL',
19+
'EXTERNAL_SERVICE_CALLBACK',
20+
'FLOW_SCREEN_DETAIL',
21+
'FOR_UPDATE_LOCKS_RELEASE',
22+
'FORMULA_BUILD',
23+
'FORMULA_EVALUATE_BEGIN',
24+
'FORMULA_EVALUATE_END',
25+
'ORG_CACHE_CONTAINS',
26+
'ORG_CACHE_GET',
27+
'ORG_CACHE_GET_CAPACITY',
28+
'ORG_CACHE_GET_PARTITION',
29+
'ORG_CACHE_PUT',
30+
'ORG_CACHE_REMOVE',
31+
'PLAY_PROMPT',
32+
'POLICY_RULE_DEFINITION_CONDITION_EVALUATION_RESPONSE',
33+
'POLICY_RULE_EVALUATION_REQUEST',
34+
'POLICY_RULE_EVALUATION_RESPONSE',
35+
'POLICY_RULE_EVALUATION_SKIPPED',
36+
'POLICY_RULE_EVALUATION_START',
37+
'PUSH_NOTIFICATION_INVALID_CONFIGURATION',
38+
'PUSH_NOTIFICATION_INVALID_PAYLOAD',
39+
'QUERY_SQL_LOG',
40+
'RLM_CONFIGURATOR_BEGIN',
41+
'RLM_CONFIGURATOR_DEPLOY',
42+
'RLM_CONFIGURATOR_END',
43+
'RLM_CONFIGURATOR_STATS',
44+
'RLM_PRICING_BEGIN',
45+
'RLM_PRICING_END',
46+
'SAVEPOINT_RELEASE',
47+
'SAVEPOINT_RESET',
48+
'SCHEDULED_FLOW_DETAIL',
49+
'SESSION_CACHE_CONTAINS',
50+
'SESSION_CACHE_GET',
51+
'SESSION_CACHE_GET_CAPACITY',
52+
'SESSION_CACHE_GET_PARTITION',
53+
'SESSION_CACHE_PUT',
54+
'SESSION_CACHE_REMOVE',
55+
'SLA_CASE_MILESTONE',
56+
'USER_MODE_PERMSET_APPLIED',
57+
'WF_CHATTER_POST',
58+
] as const;
59+
60+
it.each(newEvents)('%s is recognised by getLogEventClass', (eventName) => {
61+
expect(getLogEventClass(eventName)).not.toBeNull();
62+
});
63+
});
64+
65+
describe('debugLevel is set correctly on specialised events', () => {
66+
it.each([
67+
['METHOD_ENTRY', 'FINE'],
68+
['CODE_UNIT_STARTED', 'ERROR'],
69+
['DML_BEGIN', 'INFO'],
70+
['SOQL_EXECUTE_BEGIN', 'INFO'],
71+
['EXCEPTION_THROWN', 'INFO'],
72+
['USER_DEBUG', 'DEBUG'],
73+
])('%s has debugLevel %s', (eventName, expectedLevel) => {
74+
const logLines: Record<string, string> = {
75+
METHOD_ENTRY: '15:20:52.222 (100)|METHOD_ENTRY|[1]|01p000000000000|MyClass.myMethod()',
76+
CODE_UNIT_STARTED:
77+
'15:20:52.222 (100)|CODE_UNIT_STARTED|[EXTERNAL]|01p000000000000|MyClass.myTrigger',
78+
DML_BEGIN: '15:20:52.222 (100)|DML_BEGIN|[1]|Op:Insert|Type:Account|Rows:1',
79+
SOQL_EXECUTE_BEGIN:
80+
'15:20:52.222 (100)|SOQL_EXECUTE_BEGIN|[1]|Aggregations:0|SELECT Id FROM Account',
81+
EXCEPTION_THROWN:
82+
'15:20:52.222 (100)|EXCEPTION_THROWN|[1]|System.NullPointerException: error',
83+
USER_DEBUG: '15:20:52.222 (100)|USER_DEBUG|[1]|DEBUG|test message',
84+
};
85+
const log = parse(logLines[eventName]!);
86+
const line = log.children[0];
87+
expect(line).toBeDefined();
88+
expect(line!.debugLevel).toBe(expectedLevel);
89+
});
90+
});
91+
});

0 commit comments

Comments
 (0)