diff --git a/outlet.go b/outlet.go index a98613a..df2ea45 100644 --- a/outlet.go +++ b/outlet.go @@ -13,6 +13,8 @@ import ( type OutletFactory struct { Outlets map[string]*Outlet Padding int + + sync.Mutex } type Outlet struct { @@ -22,8 +24,6 @@ type Outlet struct { Factory *OutletFactory } -var mx sync.Mutex - var colors = []ct.Color{ ct.Cyan, ct.Yellow, @@ -68,8 +68,8 @@ func (of *OutletFactory) ErrorOutput(str string) { // Write out a single coloured line func (of *OutletFactory) WriteLine(left, right string, leftC, rightC ct.Color, isError bool) { - mx.Lock() - defer mx.Unlock() + of.Lock() + defer of.Unlock() ct.ChangeColor(leftC, true, ct.None, false) formatter := fmt.Sprintf("%%-%ds | ", of.Padding)