Class: LogApi
Laika.LogApi
Methods
generateMockCode
▸ generateMockCode(eventFilter?, options?): string
Returns a code snippet that will help you reproduce your recording without hitting actual backends.
Parameters
| Name | Type | Description |
|---|---|---|
eventFilter? | EventFilterFn | Optionally provide a function that will only keep the events you are interested in. |
options? | Object | Optionally provide code generation options to customize the output. |
options.deprioritizedKeys | undefined | string[] | - |
options.minRepeatCount | undefined | number | - |
options.nonVariableKeys | undefined | string[] | - |
options.notExtractablePartialPhrases | undefined | string[] | - |
options.skipDeduplicationKey | undefined | string[] | - |
options.skipDeduplicationValues | undefined | string[] | - |
options.skipPathNames | undefined | string[] | - |
options.substringVariables | undefined | boolean | - |
Returns
string
Defined in
markAction
▸ markAction(actionName): void
Use this function to mark a new action if recording a sequence of events.
These will show up when you generate mock code as comments, so you can more easily orient yourself in it.
example
log.markAction('opening the ticket');
// click around the site
log.markAction('changing the assignee');
Parameters
| Name | Type | Description |
|---|---|---|
actionName | string | Describe what action you will be performing, e.g. 'opening the ticket' |
Returns
void
Defined in
resetRecording
▸ resetRecording(): void
Resets the recording in preparation of another one.
Returns
void
Defined in
startLogging
▸ startLogging(matcher?): void
Starts logging every matching operation and subscription to the console. If you did not provide a matcher, it will log everything. You will see queries, mutations, and subscription pushes along with their data.

Parameters
| Name | Type |
|---|---|
matcher? | Matcher |
Returns
void
Defined in
startRecording
▸ startRecording(startingActionName?, matcher?): void
Starts the recording process. Every result will be saved until you run log.stopRecording().

Parameters
| Name | Type | Description |
|---|---|---|
startingActionName? | string | Name what you are about to do. For example "opening a new ticket". |
matcher? | Matcher | A matcher object or function to record only the events that you are interested in, for example {operationName: 'getColors', clientName: 'backend1'} will record only 'getColors' operations. |
Returns
void
Defined in
stopLogging
▸ stopLogging(): void
Stops logging to the console.
Returns
void
Defined in
stopRecording
▸ stopRecording(): void
Pauses recording without clearing what was recorded so far.
Returns
void