forked from mirror/logrus
Add Trace level logging
This commit is contained in:
parent
4981d8161c
commit
c7a33dc5de
|
@ -122,7 +122,7 @@ func Fatal(args ...interface{}) {
|
|||
std.Fatal(args...)
|
||||
}
|
||||
|
||||
// Tracef logs a message at level Debug on the standard logger.
|
||||
// Tracef logs a message at level Trace on the standard logger.
|
||||
func Tracef(format string, args ...interface{}) {
|
||||
std.Tracef(format, args...)
|
||||
}
|
||||
|
@ -167,7 +167,7 @@ func Fatalf(format string, args ...interface{}) {
|
|||
std.Fatalf(format, args...)
|
||||
}
|
||||
|
||||
// Traceln logs a message at level Debug on the standard logger.
|
||||
// Traceln logs a message at level Trace on the standard logger.
|
||||
func Traceln(args ...interface{}) {
|
||||
std.Traceln(args...)
|
||||
}
|
||||
|
|
|
@ -87,7 +87,8 @@ const (
|
|||
InfoLevel
|
||||
// DebugLevel level. Usually only enabled when debugging. Very verbose logging.
|
||||
DebugLevel
|
||||
// TraceLevel level. Usually only enabled when debugging. Very verbose logging. Usually reserved for message traces
|
||||
// TraceLevel level. Usually only enabled when debugging. Very verbose logging.
|
||||
// Usually reserved for message traces.
|
||||
TraceLevel
|
||||
)
|
||||
|
||||
|
|
|
@ -303,6 +303,7 @@ func TestDoubleLoggingDoesntPrefixPreviousFields(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestConvertLevelToString(t *testing.T) {
|
||||
assert.Equal(t, "trace", TraceLevel.String())
|
||||
assert.Equal(t, "debug", DebugLevel.String())
|
||||
assert.Equal(t, "info", InfoLevel.String())
|
||||
assert.Equal(t, "warning", WarnLevel.String())
|
||||
|
@ -368,6 +369,14 @@ func TestParseLevel(t *testing.T) {
|
|||
assert.Nil(t, err)
|
||||
assert.Equal(t, DebugLevel, l)
|
||||
|
||||
l, err = ParseLevel("trace")
|
||||
assert.Nil(t, err)
|
||||
assert.Equal(t, TraceLevel, l)
|
||||
|
||||
l, err = ParseLevel("TRACE")
|
||||
assert.Nil(t, err)
|
||||
assert.Equal(t, TraceLevel, l)
|
||||
|
||||
l, err = ParseLevel("invalid")
|
||||
assert.Equal(t, "not a valid logrus Level: \"invalid\"", err.Error())
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue