go-log/context.go

25 lines
423 B
Go
Raw Normal View History

package flog
func newContext(cascade ...interface{}) map[string]interface{} {
context := make(map[string]interface{})
for _,x := range cascade {
switch xx := x.(type) {
case map[string]string:
for key, value := range xx {
context[key] = value
}
case map[string]interface{}:
for key, value := range xx {
context[key] = value
}
case string:
context["text"] = xx
}
}
return context
}