Skip to main content

Logging FAQ

Level

  • level - importance - severity
  • 日志级别有两种表示方式:
    • SeverityText
    • SeverityNumber - Priority
      • 1-100
      • 0-7
  • Severity, Urgency
  • Filtering
  • Actionability
  • Consistency
  • Customization
  • Extensibility
meanlevelsyslogconsolego/slogOpenTelemetryslf4j
Emergencyemerg0,panic
Alertalert1
Criticalcrit2
FatalfatalFATAL, 21-24
Errorerror3,err,error8ERROR, 17-20
Warningwarn4,warning,warn4WARN, 13-16
Noticenotice5
Informationinfo60INFO, 9-12
Debugdebug7-4DEBUG, 5-8
TracetraceTRACE, 1-4

  • silent
  • fatal
  • error
    • panic
    • critical
  • warn
    • warning
  • log
  • info
    • success
    • fail
    • start
    • ready
  • debug
  • trace
  • verbose

/*
Bunyan
const levels = {
FATAL: 60,
ERROR: 50,
WARN: 40,
INFO: 30,
DEBUG: 20,
TRACE: 10
}

Pino
const levels = {
fatal: 60,
error: 50,
warn: 40,
info: 30,
debug: 20,
trace: 10
}
Winston
const levels = {
error: 0,
warn: 1,
info: 2,
debug: 3
}
Syslog RFC 3164
0 = Emergency
1 = Alert
2 = Critical
3 = Error
4 = Warning
5 = Notice
6 = Informational
7 = Debug
*/