@8select/strulo
Version:
Log messages in a structured format.
29 lines (24 loc) • 825 B
Flow
// @flow
export type LogLevel = 100 | 200 | 250 | 300 | 400 | 500 | 550 | 600
export type LogLevelName = 'DEBUG' | 'INFO' | 'NOTICE' | 'WARNING' | 'ERROR' | 'CRITICAL' | 'ALERT' | 'EMERGENCY'
const LEVEL_DEBUG: LogLevel = 100
const LEVEL_INFO: LogLevel = 200
const LEVEL_NOTICE: LogLevel = 250
const LEVEL_WARNING: LogLevel = 300
const LEVEL_ERROR: LogLevel = 400
const LEVEL_CRITICAL: LogLevel = 500
const LEVEL_ALERT: LogLevel = 550
const LEVEL_EMERGENCY: LogLevel = 600
export const logLevels = {
[]: 'DEBUG',
[]: 'INFO',
[]: 'NOTICE',
[]: 'WARNING',
[]: 'ERROR',
[]: 'CRITICAL',
[]: 'ALERT',
[]: 'EMERGENCY',
}
export const getLevelName = (level: LogLevel): LogLevelName => {
return logLevels[level]
}