// Create a SquelchingWriter with the specified list of regexps.
426426
func NewSquelchingWriter(dest io.Writer, filters []*regexp.Regexp) *SquelchingWriter {
	return &SquelchingWriter{
		filters: filters,
		dest:    dest,
	}
}
253272
func NewWriter(w io.Writer) *Writer {
	return &Writer{w: w, curr: &regFileWriter{w, 0}}
}
257857
func (p *parserMixin) RegexpList() (target *[]*regexp.Regexp) {
	target = new([]*regexp.Regexp)
	p.RegexpListVar(target)
	return
}
16842
func (d *DotGit) ShallowWriter() (billy.File, error) {
	return d.fs.Create(shallowPath)
}
1018377
func (v *VerbalExpression) Regex() *regexp.Regexp {

	if !v.compiled {
		v.regexp = regexp.MustCompile(
			strings.Join([]string{
				strings.Join(v.parts, ""),
				`(?` + v.getFlags() + `)`,
				v.prefixes,
				v.expression,
				v.suffixes}, ""))
		v.compiled = true
	}
	return v.regexp
}
1139825
func NewConsoleWriter(options ...func(w *ConsoleWriter)) ConsoleWriter {
	w := ConsoleWriter{
		Out:        os.Stdout,
		TimeFormat: consoleDefaultTimeFormat,
		PartsOrder: consoleDefaultPartsOrder(),
	}

	for _, opt := range options {
		opt(&w)
	}

	return w
}
517739
func Regexp(message string, reg *regexp.Regexp, defaultAnswer string) string {
	return (&Prompter{
		Message: message,
		Regexp:  reg,
		Default: defaultAnswer,
	}).Prompt()
}
842287
func (b ValExprBuilder) RegExp(val interface{}) BoolExprBuilder {
	return b.makeComparisonExpr(astRegExp, makeValExpr(val))
}
492013
func makeSquareMapping(face font.Face, runes []rune, padding fixed.Int26_6) (map[rune]fixedGlyph, fixed.Rectangle26_6) {
	width := sort.Search(int(fixed.I(1024*1024)), func(i int) bool {
		width := fixed.Int26_6(i)
		_, bounds := makeMapping(face, runes, padding, width)
		return bounds.Max.X-bounds.Min.X >= bounds.Max.Y-bounds.Min.Y
	})
	return makeMapping(face, runes, padding, fixed.Int26_6(width))
}
714245
func NewBatchedFileWriter(s3Client *s3.S3, bucket string, fileName string, logger logrus.FieldLogger) BatchedFileWriter {
	var s3Bucket, s3SubFolder string

	if strings.Contains(bucket, "/") {
		split := strings.SplitN(bucket, "/", 2)
		s3Bucket, s3SubFolder = split[0], split[1]
	} else {
		s3Bucket = bucket
		s3SubFolder = ""
	}

	batchedFileWriter := BatchedFileWriter{
		s3Client:    s3Client,
		s3Bucket:    s3Bucket,
		s3SubFolder: s3SubFolder,
		fileName:    fileName,
		logger:      logger,
	}

	batchedFileWriter.init()
	return batchedFileWriter
}
614887
func NewConsoleLogWriter() ConsoleLogWriter {
	records := make(ConsoleLogWriter, LogBufferLength)
	go records.run(stdout)
	return records
}
270846
func NewDefaultSyslogWriter(level loggo.Level, tag, facility string) loggo.Writer {
	if facility == "" {
		facility = "LOCAL7"
	}
	var syslogger gsyslog.Syslogger
	var err error
	// retry opening the syslog device as this may fail under load or in cases where the
	// process is forked.
	for i := 0; i < 3; i++ {
		syslogger, err = gsyslog.NewLogger(convertLevel(level), facility, tag)
		if err == nil {
			continue
		}
		// back off for a second
		time.Sleep(1 * time.Second)
	}
	if err != nil {
		panic(err) // of course this will never happen
	}
	return &syslogWriter{syslogger, DefaultFormatter}
}
906579
func QuotePattern(pattern string) string {
	any := false
loop:
	for _, r := range pattern {
		switch r {
		case '*', '?', '[', '\\':
			any = true
			break loop
		}
	}
	if !any { // short-cut without a string copy
		return pattern
	}
	var buf bytes.Buffer
	for _, r := range pattern {
		switch r {
		case '*', '?', '[', '\\':
			buf.WriteByte('\\')
		}
		buf.WriteRune(r)
	}
	return buf.String()
}
1354428
func synchronizedWriters(targets ...io.Writer) []io.Writer {
	mutex := &sync.Mutex{}
	ret := make([]io.Writer, len(targets))
	for i, target := range targets {
		ret[i] = &synchronizedWriter{
			Writer: target,
			mutex:  mutex,
		}
	}
	return ret
}
1336919
func newMockWriter() *mockWriter {
	msgChan := make(chan string)
	getChan := make(chan []string)
	clearChan := make(chan struct{})
	closeChan := make(chan struct{})
	w := &mockWriter{
		logged:    []string{},
		msgChan:   msgChan,
		getChan:   getChan,
		clearChan: clearChan,
		closeChan: closeChan,
	}
	go func() {
		for {
			select {
			case logMsg := <-msgChan:
				w.logged = append(w.logged, logMsg)
			case getChan <- w.logged:
			case <-clearChan:
				w.logged = []string{}
			case <-closeChan:
				close(getChan)
				return
			}
		}
	}()
	return w
}
1035598
func NewMultiWriteCloser(writeClosers ...io.WriteCloser) io.WriteCloser {
	writers := make([]io.Writer, len(writeClosers))
	for i, w := range writeClosers {
		writers[i] = w
	}
	return multiWriteCloser{Writer: io.MultiWriter(writers...), closers: writeClosers}
}
710844
func NewWriteLogger(prefix string, w io.Writer) io.Writer {
	return &writeLogger{prefix, w}
}