logxi
logxi copied to clipboard
Fit formatter
Hello. There 3 formatters.
RegisterFormatFactory(FormatHappy, formatFactory)
RegisterFormatFactory(FormatText, formatFactory)
RegisterFormatFactory(FormatJSON, formatFactory)
So the question is - what "fit" means. You're parsing env, there are not fit there. So it assignes formatterFormat to "fit", (and overrides previous value, happy e.g.).
for key, value := range m {
switch key {
default:
formatterFormat = key
case "t":
tFormat = value
case "pretty":
isPretty = value != "false" && value != "0"
case "maxcol":
col, err := strconv.Atoi(value)
if err == nil {
maxCol = col
} else {
maxCol = defaultMaxCol
}
case "context":
lines, err := strconv.Atoi(value)
if err == nil {
contextLines = lines
} else {
contextLines = defaultContextLines
}
case "LTSV":
formatterFormat = "text"
AssignmentChar = ltsvAssignmentChar
Separator = ltsvSeparator
}
}
you have it on main.go
p.Task("isolate", do.S{"build"}, func(c *do.Context) {
c.Bash("LOGXI=* LOGXI_FORMAT=fit,maxcol=80,t=04:05.000,context=2 demo", do.M{"$in": "v1/cmd/demo"})
})
init.go
defaultLogxiFormatEnv = "happy,fit,maxcol=80,t=15:04:05.000000,context=-1"
i think it should be removed?