diff --git a/globals.go b/globals.go index 421429a..2c60382 100644 --- a/globals.go +++ b/globals.go @@ -27,7 +27,22 @@ var ( // LevelFieldName is the field name used for the level field. LevelFieldName = "level" - // LevelFieldMarshalFunc allows customization of global level field marshaling + // LevelTraceValue is the value used for the trace level field. + LevelTraceValue = "trace" + // LevelDebugValue is the value used for the debug level field. + LevelDebugValue = "debug" + // LevelInfoValue is the value used for the info level field. + LevelInfoValue = "info" + // LevelWarnValue is the value used for the warn level field. + LevelWarnValue = "warn" + // LevelErrorValue is the value used for the error level field. + LevelErrorValue = "error" + // LevelFatalValue is the value used for the fatal level field. + LevelFatalValue = "fatal" + // LevelPanicValue is the value used for the panic level field. + LevelPanicValue = "panic" + + // LevelFieldMarshalFunc allows customization of global level field marshaling. LevelFieldMarshalFunc = func(l Level) string { return l.String() } diff --git a/log.go b/log.go index e6ed76b..6bc6a80 100644 --- a/log.go +++ b/log.go @@ -134,19 +134,19 @@ const ( func (l Level) String() string { switch l { case TraceLevel: - return "trace" + return LevelTraceValue case DebugLevel: - return "debug" + return LevelDebugValue case InfoLevel: - return "info" + return LevelInfoValue case WarnLevel: - return "warn" + return LevelWarnValue case ErrorLevel: - return "error" + return LevelErrorValue case FatalLevel: - return "fatal" + return LevelFatalValue case PanicLevel: - return "panic" + return LevelPanicValue case Disabled: return "disabled" case NoLevel: