Common Apex Usage Patters
This articles details of some of the more common logging patterns.
Basic Apex Logging
public void basicApexLogging() {
Triton.instance.startTransaction();
Triton.instance.debug(TritonTypes.Type.Backend,//type
TritonTypes.Area.Accounts,//functional area
'Apex logging example Pre-dml',//summary
'Pre dml update. Processing account records'); //details
try {
List<Account> accounts = [SELECT Id, Name FROM Account LIMIT 1];
if (!accounts.isEmpty()) {
Triton.instance.debug(TritonTypes.Type.Backend,
TritonTypes.Area.Accounts,
'Account records found!',
'Pre dml update. Processing account records');
accounts[0].Name = 'Logging rules!';
update accounts;
}
} catch (Exception e) {
//uh-oh... we have an Exception on our hands. Let's log that!
Triton.instance.error(TritonTypes.Area.Accounts, e);
} finally {
Triton.instance.stopTransaction();
}
}
Parent and Child Logs
Last updated