Skip to content

feat(core): Export _INTERNAL_captureSerializedLog #16387

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

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ export { trpcMiddleware } from './trpc';
export { wrapMcpServerWithSentry } from './mcp-server';
export { captureFeedback } from './feedback';
export type { ReportDialogOptions } from './report-dialog';
export { _INTERNAL_captureLog, _INTERNAL_flushLogsBuffer } from './logs/exports';
export { _INTERNAL_captureLog, _INTERNAL_flushLogsBuffer, _INTERNAL_captureSerializedLog } from './logs/exports';
export { consoleLoggingIntegration } from './logs/console-integration';

export type { FeatureFlag } from './featureFlags';
Expand Down
13 changes: 11 additions & 2 deletions packages/core/src/logs/exports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,16 @@ export function logAttributeToSerializedLogAttribute(value: unknown): Serialized
}
}

function defaultCaptureSerializedLog(client: Client, serializedLog: SerializedLog): void {
/**
* Captures a serialized log event and adds it to the log buffer for the given client.
*
* @param client - A client. Uses the current client if not provided.
* @param serializedLog - The serialized log event to capture.
*
* @experimental This method will experience breaking changes. This is not yet part of
* the stable Sentry SDK API and can be changed or removed without warning.
*/
export function _INTERNAL_captureSerializedLog(client: Client, serializedLog: SerializedLog): void {
const logBuffer = _INTERNAL_getLogBuffer(client);
if (logBuffer === undefined) {
GLOBAL_OBJ._sentryClientToLogBufferMap?.set(client, [serializedLog]);
Expand All @@ -88,7 +97,7 @@ export function _INTERNAL_captureLog(
beforeLog: Log,
client: Client | undefined = getClient(),
scope = getCurrentScope(),
captureSerializedLog: (client: Client, log: SerializedLog) => void = defaultCaptureSerializedLog,
captureSerializedLog: (client: Client, log: SerializedLog) => void = _INTERNAL_captureSerializedLog,
): void {
if (!client) {
DEBUG_BUILD && logger.warn('No client available to capture log.');
Expand Down
Loading