logger/constants.go

26 lines
1.6 KiB
Go

package logger
const (
CtxKeyRequestID = "request_id"
)
const (
SeverityTraceLevel = 6
SeverityDebugLevel = 5
SeverityInfoLevel = 4
SeverityWarnLevel = 3
SeverityErrorLevel = 2
SeverityFatalLevel = 1
)
var (
MapStringSeverityLevel = map[int]string{
SeverityFatalLevel: "FATAL", // Any error that is forcing a shutdown of the service or application to prevent data loss (or further data loss). I reserve these only for the most heinous errors and situations where there is guaranteed to have been data corruption or loss
SeverityErrorLevel: "ERROR", // Any error which is fatal to the operation, but not the service or application (can't open a required file, missing data, etc.). These errors will force user (administrator, or direct user) intervention. These are usually reserved (in my apps) for incorrect connection strings, missing services, etc.
SeverityWarnLevel: "WARN", // Anything that can potentially cause application oddities, but for which I am automatically recovering. (Such as switching from a primary to backup server, retrying an operation, missing secondary data, etc.)
SeverityInfoLevel: "INFO", // Generally useful information to log (service start/stop, configuration assumptions, etc). Info I want to always have available but usually don't care about under normal circumstances. This is my out-of-the-box config level.
SeverityDebugLevel: "DEBUG", // Information that is diagnostically helpful to people more than just developers (IT, sysadmins, etc.).
SeverityTraceLevel: "TRACE", // Only when I would be "tracing" the code and trying to find one part of a function specifically.
}
)