Skip to main content

TestingLogger

The TestingLogger can be used in unit tests or e2e tests to make assertions on whether the various Logger methods have been called, and which arguments.

Here's some examples of how to use it in e2e tests and unit tests. In both cases we are using the Jest testing framework, but the TestingLogger should work with other similar frameworks (e.g. replacing jest.fn() with jasmine.createSpy()).

Example

Ts

Example

Ts
Signature

constructor

method(createSpyFn: () => Spy) => TestingLogger

debugSpy

propertySpy

errorSpy

propertySpy

infoSpy

propertySpy

verboseSpy

propertySpy

warnSpy

propertySpy

debug

method(message: string, context?: string) => void

error

method(message: string, context?: string, trace?: string) => void

info

method(message: string, context?: string) => void

verbose

method(message: string, context?: string) => void

warn

method(message: string, context?: string) => void
Was this chapter helpful?
Report Issue
Edited Feb 25, 2026ยทEdit this page