Skip to content

Commit e7a67cd

Browse files
committed
feat: Add log function
1 parent 03ea1fd commit e7a67cd

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

packages/core/src/exports.ts

+7
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,13 @@ export const _experiment_log = {
366366
* Ex: Sentry._experiment_log.info`user ${username} just bought ${item}!`
367367
*/
368368
info: sendLog.bind(null, 'info') as OmitFirstArg<typeof sendLog>,
369+
/**
370+
* A utility to record a log with level 'INFO' and send it to sentry.
371+
*
372+
* Logs represent a message and some parameters which provide context for a trace or error.
373+
* Ex: Sentry._experiment_log.log`user ${username} just bought ${item}!`
374+
*/
375+
log: sendLog.bind(null, 'log') as OmitFirstArg<typeof sendLog>,
369376
/**
370377
* A utility to record a log with level 'ERROR' and send it to sentry.
371378
*

packages/core/src/log.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@ let GLOBAL_LOG_BUFFER: Log[] = [];
1313

1414
let isFlushingLogs = false;
1515

16-
const SEVERITY_TEXT_TO_SEVERITY_NUMBER: Partial<Record<LogSeverityLevel, number>> = {
16+
const SEVERITY_TEXT_TO_SEVERITY_NUMBER: Partial<Record<LogSeverityLevel | 'log', number>> = {
1717
trace: 1,
18+
log: 2,
1819
debug: 5,
1920
info: 9,
2021
warn: 13,

0 commit comments

Comments
 (0)