-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Dhaval Heruwala edited this page Apr 7, 2020
·
20 revisions
Welcome to the SFLogging wiki!
Once the package is deployed, to test the functionality, paste the following code in Execute Anonymous Developer console
` SavePoint sp = Database.setSavepoint(); Log.push('MyClass.methodA'); insert new Account (name = 'Test'); Log.push('MyClass.methodB'); Log.message('Doing something'); insert new Account (name = 'Test'); Log.pop();
List<Account> accounts = [select Id from Account];
Log.push('MyClass.methodC');
List<Account> accounts2 = [select Id from Account];
Log.pop();
Log.message('Doing something else');
Log.pop(); Database.rollback(sp); Log.emit(); `
Add a Demo Class
`public class MalformedQuery {
public static void TestMalformedQuery(){
Log.push('MalformedQuery.TestMalformedQuery');
Log.message('Testing Malformed Query');
Opportunity[] opps = [SELECT Name,NextStep FROM Opportunity];
opps = [SELECT Name,Probability,StageName FROM Opportunity];
Log.pop();
Log.emit();
}
}`
Test the class by pasting MalformedQuery.TestMalformedQuery();
in the developer console.