// Returns a log where "log.HasErrors()" only returns true if any errors have
// been logged since this call. This is useful when there have already been
// errors logged by other linkers that share the same log.
Returns a log where "log.HasErrors()" only returns true if any errors have
been logged since this call. This is useful when there have already been
errors logged by other linkers that share the same log.
// Returns a log where " log . HasErrors () " only returns true if any errors have // been logged since this call . This is useful when there have already been // errors logged by other linkers that share the same log .
func wrappedLog(log logger.Log) logger.Log {
	var mutex sync.Mutex
	var hasErrors bool
	addMsg := log.AddMsg
	log.AddMsg = func(msg logger.Msg) {
		if msg.Kind == logger.Error {
			mutex.Lock()
			defer mutex.Unlock()
			hasErrors = true
		}
		addMsg(msg)
	}
	log.HasErrors = func() bool {
		mutex.Lock()
		defer mutex.Unlock()
		return hasErrors
	}
	return log
}
func wrappedLog ( log logger . Log ) logger . Log { var mutex sync . Mutex var hasErrors bool addMsg := log . AddMsg log . AddMsg = func ( msg logger . Msg ) { if msg . Kind == logger . Error { mutex . Lock ( ) defer mutex . Unlock ( ) hasErrors = true } addMsg ( msg ) } log . HasErrors = func ( ) bool { mutex . Lock ( ) defer mutex . Unlock ( ) return hasErrors } return log }
Returns a log where "log.HasErrors()" only returns true if any errors have
been logged since this call.
Returns a log where " log . HasErrors () " only returns true if any errors have been logged since this call .