Skip to content

Commit

Permalink
Merge pull request cihub#108 from eyasuyuki/master
Browse files Browse the repository at this point in the history
add %r for windos
  • Loading branch information
goodsign committed Mar 26, 2016
2 parents 3549fbb + 6dc4b15 commit a113d9f
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 a113d9f

Please sign in to comment.