File tree Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ import type {
99import { serializeError } from 'serialize-error' ;
1010import { sentry } from '../sentry' ;
1111import { getTraceId } from '../sentry/utils' ;
12+ import type { SeverityLevel } from '../sentry/types' ;
1213
1314export const roarr = ( function ( ) {
1415 const createLogger = ( methodName : LoggerLoggingMethodName ) => {
@@ -26,6 +27,13 @@ export const roarr = (function () {
2627 : contextClone ,
2728 message ,
2829 ) ;
30+
31+ sentry ?. addBreadcrumb ( {
32+ type : 'default' ,
33+ category : 'console' ,
34+ message : JSON . stringify ( { message, context : contextClone } ) ,
35+ level : convertLogLevelNameRoarrToSentry ( methodName ) ,
36+ } ) ;
2937 } ;
3038 } ;
3139
@@ -119,3 +127,18 @@ function getFileName(): string {
119127
120128 return fileName . replace ( config . folders . root , '' ) ;
121129}
130+
131+ function convertLogLevelNameRoarrToSentry (
132+ methodName : LoggerLoggingMethodName ,
133+ ) : SeverityLevel {
134+ const methodNameWithoutOnce = methodName . replace ( 'Once' , '' ) ;
135+
136+ switch ( methodNameWithoutOnce ) {
137+ case 'trace' :
138+ return 'debug' ;
139+ case 'warn' :
140+ return 'warning' ;
141+ default :
142+ return methodName as SeverityLevel ;
143+ }
144+ }
Original file line number Diff line number Diff line change 1+ export type { SeverityLevel } from '@sentry/sveltekit' ;
You can’t perform that action at this time.
0 commit comments