pino-splunk-events
Version:
Pino transport layer to splunk-events
13 lines (8 loc) • 392 B
text/typescript
import { LOG_VALUE_TO_LABEL } from './toSplunkEvent'
import type { PinoLevelLabel, SplunkLog } from './toSplunkEvent'
export type ConsoleLevel = Exclude<PinoLevelLabel, 'fatal'>
export const getConsoleLevelFromSplunkLog = (log: SplunkLog) => {
const levelLabel = LOG_VALUE_TO_LABEL[log.level]
const consoleLevel = levelLabel === 'fatal' ? 'error' : levelLabel
return consoleLevel
}