added Writers func
This commit is contained in:
@@ -119,19 +119,31 @@ func Writer(w io.Writer, debug, info string) Interface {
|
|||||||
return writerInterface{
|
return writerInterface{
|
||||||
debug: debug,
|
debug: debug,
|
||||||
info: info,
|
info: info,
|
||||||
w: w,
|
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 {
|
type writerInterface struct {
|
||||||
debug, info string
|
debug, info string
|
||||||
w io.Writer
|
wDebug, wInfo io.Writer
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w writerInterface) Print(v string) {
|
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) {
|
func (w writerInterface) Debug(v string) {
|
||||||
fmt.Fprint(w.w, w.debug, v)
|
fmt.Fprint(w.wDebug, w.debug, v)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user