rename some mlog files, change KVer interface slightly

This commit is contained in:
Brian Picciano 2018-02-15 21:23:04 +00:00
parent 3d43caba18
commit 93cfa66c4b
2 changed files with 7 additions and 6 deletions

View File

@ -98,17 +98,18 @@ func LevelFromString(ls string) (Level, error) {
// KVer is used to provide context to a log entry in the form of a dynamic set // KVer is used to provide context to a log entry in the form of a dynamic set
// of key/value pairs which can be different for every entry. // of key/value pairs which can be different for every entry.
// //
// Each returned map should be modifiable. // Each returned KV should be modifiable.
type KVer interface { type KVer interface {
KV() map[string]interface{} KV() KV
} }
// KV is a simple and convenient implementation of KVer // KV is a set of key/value pairs which provides context for a log entry by a
// KVer. KV is itself also a KVer.
type KV map[string]interface{} type KV map[string]interface{}
// KV implements the KVer method by returning a copy of the casted KV // KV implements the KVer method by returning a copy of the KV
func (kv KV) KV() map[string]interface{} { func (kv KV) KV() KV {
nkv := make(map[string]interface{}, len(kv)) nkv := make(KV, len(kv))
for k, v := range kv { for k, v := range kv {
nkv[k] = v nkv[k] = v
} }