File tree Expand file tree Collapse file tree 1 file changed +18
-11
lines changed
packages/pino-transport/src Expand file tree Collapse file tree 1 file changed +18
-11
lines changed Original file line number Diff line number Diff line change @@ -215,30 +215,37 @@ function mapPinoLevelToSentryLevel(level: unknown, levelsConfig?: unknown): LogS
215
215
* Maps a numeric level to the closest Sentry severity level using range-based mapping.
216
216
* Handles both standard Pino levels and custom numeric levels.
217
217
*
218
+ * - `0-19` -> `trace`
219
+ * - `20-29` -> `debug`
220
+ * - `30-39` -> `info`
221
+ * - `40-49` -> `warn`
222
+ * - `50-59` -> `error`
223
+ * - `60+` -> `fatal`
224
+ *
218
225
* @see https://github.com/pinojs/pino/blob/116b1b17935630b97222fbfd1c053d199d18ca4b/lib/constants.js#L6-L13
219
226
*/
220
227
function mapNumericLevelToSentryLevel ( numericLevel : number ) : LogSeverityLevel {
221
- // 0-14 -> trace (includes standard 10)
222
- if ( numericLevel < 15 ) {
228
+ // 0-19 -> trace
229
+ if ( numericLevel < 20 ) {
223
230
return 'trace' ;
224
231
}
225
- // 15-24 -> debug (includes standard 20)
226
- if ( numericLevel < 25 ) {
232
+ // 20-29 -> debug
233
+ if ( numericLevel < 30 ) {
227
234
return 'debug' ;
228
235
}
229
- // 25-34 -> info (includes standard 30)
230
- if ( numericLevel < 35 ) {
236
+ // 30-39 -> info
237
+ if ( numericLevel < 40 ) {
231
238
return 'info' ;
232
239
}
233
- // 35-44 -> warn (includes standard 40)
234
- if ( numericLevel < 45 ) {
240
+ // 40-49 -> warn
241
+ if ( numericLevel < 50 ) {
235
242
return 'warn' ;
236
243
}
237
- // 45-54 -> error (includes standard 50)
238
- if ( numericLevel < 55 ) {
244
+ // 50-59 -> error
245
+ if ( numericLevel < 60 ) {
239
246
return 'error' ;
240
247
}
241
- // 55 + -> fatal (includes standard 60)
248
+ // 60 + -> fatal
242
249
return 'fatal' ;
243
250
}
244
251
You can’t perform that action at this time.
0 commit comments