func (m *Messenger) ExitCode(e int) int {
	m.Lock()
	old := m.ecode
	m.ecode = e
	m.Unlock()
	return old
}
ExitCode sets the exit code used by Die.

The default is 1.

Returns the old error code.
package msg
import (
	"bufio"
	"fmt"
	"io"
	"os"
	"strings"
	"sync"
	"github.com/Masterminds/vcs"
)
type Messenger struct {
	sync.Mutex
	Quiet bool
	IsDebugging bool
	IsVerbose bool
	NoColor bool
	Stdout io.Writer
	Stderr io.Writer
	Stdin io.Reader
	PanicOnDie bool
	ecode int
	hasErrored bool
}
func NewMessenger() *Messenger {
	m := &Messenger{
		Quiet:       false,
		IsDebugging: false,
		IsVerbose:   false,
		NoColor:     false,
		Stdout:      os.Stdout,
		Stderr:      os.Stderr,
		Stdin:       os.Stdin,
		PanicOnDie:  false,
		ecode:       1,
	}
	return m
}
var Default = NewMessenger()
func (m *Messenger) Info(msg string, args ...interface{}) {
	if m.Quiet {
		return
	}
	prefix := m.Color(Green, "[INFO]\t")
	m.Msg(prefix+msg, args...)
}
func Info(msg string, args ...interface{}) {
	Default.Info(msg, args...)
}
func (m *Messenger) Debug(msg string, args ...interface{}) {
	if m.Quiet || !m.IsDebugging {
		return
	}
	prefix := "[DEBUG]\t"
	m.Msg(prefix+msg, args...)
}
func Debug(msg string, args ...interface{}) {
	Default.Debug(msg, args...)
}
func (m *Messenger) Verbose(msg string, args ...interface{}) {
	if m.Quiet || !m.IsVerbose {
		return
	}
	m.Info(msg, args...)
}
func Verbose(msg string, args ...interface{}) {
	Default.Verbose(msg, args...)
}
func (m *Messenger) Warn(msg string, args ...interface{}) {
	prefix := m.Color(Yellow, "[WARN]\t")
	m.Msg(prefix+msg, args...)
}
func Warn(msg string, args ...interface{}) {
	Default.Warn(msg, args...)
}
func (m *Messenger) Err(msg string, args ...interface{}) {
	prefix := m.Color(Red, "[ERROR]\t")
	m.Msg(prefix+msg, args...)
	m.hasErrored = true
}
func Err(msg string, args ...interface{}) {
	Default.Err(msg, args...)
}
func (m *Messenger) Die(msg string, args ...interface{}) {
	m.Err(msg, args...)
	if m.PanicOnDie {
		panic("trapped a Die() call")
	}
	os.Exit(m.ecode)
}
func Die(msg string, args ...interface{}) {
	Default.Die(msg, args...)
}