From 0a96d5c61ead3d6b6b73a75ceef40033ef2af3b5 Mon Sep 17 00:00:00 2001 From: Brian Picciano Date: Thu, 19 Jul 2018 19:37:05 +0000 Subject: [PATCH] m: add TODO to figure out wtf to do about m.Log --- m/m.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/m/m.go b/m/m.go index e982a7b..c223b28 100644 --- a/m/m.go +++ b/m/m.go @@ -11,6 +11,16 @@ import ( "github.com/mediocregopher/mediocre-go-lib/mlog" ) +// TODO this isn't going to work. At some point there will be something like +// mhttp which will have some glue code for it in here, but then something +// within it which logs (like the http server), and then there'll be an import +// cycle. +// +// Ultimately it might be worthwhile to make Logger be a field on Cfg, that +// really seems like the only other place where code like this makes sense to +// go. But then that's greatly expanding the purview of Cfg, which is +// unfortunate.... + // Log returns a Logger which will automatically include with the log extra // contextual information based on the Cfg and the given KVs // @@ -18,7 +28,7 @@ import ( func Log(cfg *mcfg.Cfg, kvs ...mlog.KVer) *mlog.Logger { fn := cfg.FullName() l := mlog.DefaultLogger.WithWriteFn(func(w io.Writer, msg mlog.Message) error { - msg.Msg = fn + " " + msg.Msg + msg.Msg = "(" + fn + ") " + msg.Msg return mlog.DefaultWriteFn(w, msg) }) if len(kvs) > 0 {