Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add explicit logging functions #42

Merged
merged 7 commits into from
Apr 22, 2024
Merged

Add explicit logging functions #42

merged 7 commits into from
Apr 22, 2024

Conversation

aklarfeld
Copy link
Contributor

@aklarfeld aklarfeld commented Apr 21, 2024

  • Adds three functions to enable more fine grained logging
  • Capture functions do not require await, if useRemoteConfig is set to false
  • Capture functions do not flush automatically, flush still needs to happen explicitly or on an interval
  • Fixes issue with AllowedDomains not being passed in to native http.get and http.request calls.

New Functions:

Supergood.withCapture allows only async functions within the context to be logged with Supergood.

Usage:

await asyncCall0();

const asyncCall3Result = await Supergood.withCapture(supergoodArgs, async () => {
  await asyncCall1();
  await asyncCall2();
  return asyncCall3();
});
await Supergood.close();

await asyncCall4();

Only asyncCalls 1 - 3 will be logged with Supergood, and 0 & 4 will be ignored.

Supergood.startCapture and Supergood.stopCapture will perform the same functionality as above, but without the wrapped context.

Usage:

await asyncCall0();

Supergood.startCapture(supergoodArgs);

await asyncCall1();
await asyncCall2();
await asyncCall3();

Supergood.stopCapture();

await asyncCall4();

await Supergood.close();

Similar to the previous above, only asyncCalls 1 - 3 will be logged with Supergood, and 0 & 4 will be ignored.

@aklarfeld aklarfeld merged commit c8c5291 into master Apr 22, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant