Skip to content

Commit

Permalink
add %r for windos
Browse files Browse the repository at this point in the history
  • Loading branch information
eyasuyuki committed Mar 25, 2016
1 parent 3549fbb commit 6dc4b15
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions format.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ var formatterFuncs = map[string]FormatterFunc{
"UTCTime": formatterUTCTime,
"Ns": formatterNs,
"UTCNs": formatterUTCNs,
"r": formatterr,
"n": formattern,
"t": formattert,
}
Expand Down Expand Up @@ -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"
}
Expand Down
1 change: 1 addition & 0 deletions format_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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},
}
Expand Down

0 comments on commit 6dc4b15

Please sign in to comment.