diff --git a/format.go b/format.go index 32682f3..ec47b45 100644 --- a/format.go +++ b/format.go @@ -99,6 +99,7 @@ var formatterFuncs = map[string]FormatterFunc{ "UTCTime": formatterUTCTime, "Ns": formatterNs, "UTCNs": formatterUTCNs, + "r": formatterr, "n": formattern, "t": formattert, } @@ -422,6 +423,10 @@ func formatterUTCNs(message string, level LogLevel, context LogContextInterface) return context.CallTime().UTC().UnixNano() } +func formatterr(message string, level LogLevel, context LogContextInterface) interface{} { + return "\r" +} + func formattern(message string, level LogLevel, context LogContextInterface) interface{} { return "\n" } diff --git a/format_test.go b/format_test.go index dd61bdf..3cac6b4 100644 --- a/format_test.go +++ b/format_test.go @@ -121,6 +121,7 @@ var formatTests = []formatTest{ {"[%Level]%MsgX[%Level]", "test", ErrorLvl, "[Error]testX[Error]", false}, {"%Levell%Msgl", "Test", CriticalLvl, "CriticallTestl", false}, {"%Lev%Msg%LEVEL%LEV%l%Msg", "Test", InfoLvl, "InfTestINFOINFiTest", false}, + {"%r", "", CriticalLvl, "\r", false}, {"%n", "", CriticalLvl, "\n", false}, {"%t", "", CriticalLvl, "\t", false}, }