From 93cfa66c4b79ceec019988e7b9c87ab51e56a1bb Mon Sep 17 00:00:00 2001 From: Brian Picciano Date: Thu, 15 Feb 2018 21:23:04 +0000 Subject: [PATCH] rename some mlog files, change KVer interface slightly --- mlog/{llog.go => mlog.go} | 13 +++++++------ mlog/{llog_test.go => mlog_test.go} | 0 2 files changed, 7 insertions(+), 6 deletions(-) rename mlog/{llog.go => mlog.go} (96%) rename mlog/{llog_test.go => mlog_test.go} (100%) diff --git a/mlog/llog.go b/mlog/mlog.go similarity index 96% rename from mlog/llog.go rename to mlog/mlog.go index 188f96c..6c498e8 100644 --- a/mlog/llog.go +++ b/mlog/mlog.go @@ -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 // 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 { - 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{} -// KV implements the KVer method by returning a copy of the casted KV -func (kv KV) KV() map[string]interface{} { - nkv := make(map[string]interface{}, len(kv)) +// KV implements the KVer method by returning a copy of the KV +func (kv KV) KV() KV { + nkv := make(KV, len(kv)) for k, v := range kv { nkv[k] = v } diff --git a/mlog/llog_test.go b/mlog/mlog_test.go similarity index 100% rename from mlog/llog_test.go rename to mlog/mlog_test.go