From 5092da67213f0e040bcd15a5d54c5a7864a7cd23 Mon Sep 17 00:00:00 2001 From: Stephen Searles Date: Sat, 21 Nov 2015 13:51:16 -0800 Subject: [PATCH] added Writers func --- log.go | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/log.go b/log.go index 9611c60..f81bf35 100644 --- a/log.go +++ b/log.go @@ -117,21 +117,33 @@ type Interface interface { // write to w. func Writer(w io.Writer, debug, info string) Interface { return writerInterface{ - debug: debug, - info: info, - w: w, + debug: debug, + info: info, + wDebug: w, + wInfo: w, + } +} + +// Writers returns an Interface with the given debug and info prefixes that +// write to wDebug and wInfo respectively. +func Writers(wDebug, wInfo io.Writer, debug, info string) Interface { + return writerInterface{ + debug: debug, + info: info, + wDebug: wDebug, + wInfo: wInfo, } } type writerInterface struct { - debug, info string - w io.Writer + debug, info string + wDebug, wInfo io.Writer } func (w writerInterface) Print(v string) { - fmt.Fprint(w.w, w.info, v) + fmt.Fprint(w.wInfo, w.info, v) } func (w writerInterface) Debug(v string) { - fmt.Fprint(w.w, w.debug, v) + fmt.Fprint(w.wDebug, w.debug, v) }