Skip to content

Commit

Permalink
Simplified the setup of the test logger instance
Browse files Browse the repository at this point in the history
  • Loading branch information
rob-baillie-ortoo committed Apr 19, 2022
1 parent 912d43f commit 3e3cffc
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,15 @@ public with sharing class TestLoggerUtils
LoggerService.config = new Logging_Configuration__c();
}

/**
* Registers the test logger service and returns it.
*
* Also switches on logging at all levels. If you require a different logging level, you can set it
* *after* registering the test logger
*/
public static TestLoggerService registerTestLoggerService()
{
switchLoggingOn();
TestLoggerService testLogger = new TestLoggerService();
Application.SERVICE.setMock( ILoggerService.class, testLogger );
return testLogger;
Expand Down

0 comments on commit 3e3cffc

Please sign in to comment.