// Output enables *C to be used as a logger in functions that require only
// the minimum interface of *log.Logger.
978985
func (c *C) Output(calldepth int, s string) error {
	d := time.Now().Sub(c.startTime)
	msec := d / time.Millisecond
	sec := d / time.Second
	min := d / time.Minute

	c.Logf("[LOG] %d:%02d.%03d %s", min, sec%60, msec%1000, s)
	return nil
}
764079
func (d *Dataset) Output(f func(io.Reader) error) *Dataset {
	step := d.Flow.AddAllToOneStep(d, nil)
	step.IsOnDriverSide = true
	step.Name = "Output"
	step.Function = func(readers []io.Reader, writers []io.Writer, stat *pb.InstructionStat) error {
		errChan := make(chan error, len(readers))
		for i, reader := range readers {
			go func(i int, reader io.Reader) {
				errChan <- f(reader)
			}(i, reader)
		}
		for range readers {
			err := <-errChan
			if err != nil {
				fmt.Fprintf(os.Stderr, "Failed to process output: %v\n", err)
				return err
			}
		}
		return nil
	}
	return d
}
373539
func (fs *FileSorter) Output() ([]types.Datum, []types.Datum, int64, error) {
	var (
		r   *comparableRow
		err error
	)
	if fs.closed {
		return nil, nil, 0, errors.New("FileSorter has been closed")
	}

	if fs.external {
		r, err = fs.externalSort()
	} else {
		r, err = fs.internalSort()
	}

	if err != nil {
		return nil, nil, 0, errors.Trace(err)
	} else if r != nil {
		return r.key, r.val, r.handle, nil
	} else {
		return nil, nil, 0, nil
	}
}
351846
func (l *Logger) Print(v ...interface{}) {
	l.Emit(0, fmt.Sprint(v...), nil)
}
1346412
func (p *printer) output(n interface{}) []byte {
	var buf bytes.Buffer

	switch t := n.(type) {
	case *ast.File:
		// File doesn't trace so we add the tracing here
		defer un(trace(p, "File"))
		return p.output(t.Node)
	case *ast.ObjectList:
		defer un(trace(p, "ObjectList"))

		var index int
		for {
			// Determine the location of the next actual non-comment
			// item. If we're at the end, the next item is at "infinity"
			var nextItem token.Pos
			if index != len(t.Items) {
				nextItem = t.Items[index].Pos()
			} else {
				nextItem = token.Pos{Offset: infinity, Line: infinity}
			}

			// Go through the standalone comments in the file and print out
			// the comments that we should be for this object item.
			for _, c := range p.standaloneComments {
				// Go through all the comments in the group. The group
				// should be printed together, not separated by double newlines.
				printed := false
				newlinePrinted := false
				for _, comment := range c.List {
					// We only care about comments after the previous item
					// we've printed so that comments are printed in the
					// correct locations (between two objects for example).
					// And before the next item.
					if comment.Pos().After(p.prev) && comment.Pos().Before(nextItem) {
						// if we hit the end add newlines so we can print the comment
						// we don't do this if prev is invalid which means the
						// beginning of the file since the first comment should
						// be at the first line.
						if !newlinePrinted && p.prev.IsValid() && index == len(t.Items) {
							buf.Write([]byte{newline, newline})
							newlinePrinted = true
						}

						// Write the actual comment.
						buf.WriteString(comment.Text)
						buf.WriteByte(newline)

						// Set printed to true to note that we printed something
						printed = true
					}
				}

				// If we're not at the last item, write a new line so
				// that there is a newline separating this comment from
				// the next object.
				if printed && index != len(t.Items) {
					buf.WriteByte(newline)
				}
			}

			if index == len(t.Items) {
				break
			}

			buf.Write(p.output(t.Items[index]))
			if index != len(t.Items)-1 {
				// Always write a newline to separate us from the next item
				buf.WriteByte(newline)

				// Need to determine if we're going to separate the next item
				// with a blank line. The logic here is simple, though there
				// are a few conditions:
				//
				//   1. The next object is more than one line away anyways,
				//      so we need an empty line.
				//
				//   2. The next object is not a "single line" object, so
				//      we need an empty line.
				//
				//   3. This current object is not a single line object,
				//      so we need an empty line.
				current := t.Items[index]
				next := t.Items[index+1]
				if next.Pos().Line != t.Items[index].Pos().Line+1 ||
					!p.isSingleLineObject(next) ||
					!p.isSingleLineObject(current) {
					buf.WriteByte(newline)
				}
			}
			index++
		}
	case *ast.ObjectKey:
		buf.WriteString(t.Token.Text)
	case *ast.ObjectItem:
		p.prev = t.Pos()
		buf.Write(p.objectItem(t))
	case *ast.LiteralType:
		buf.Write(p.literalType(t))
	case *ast.ListType:
		buf.Write(p.list(t))
	case *ast.ObjectType:
		buf.Write(p.objectType(t))
	default:
		fmt.Printf(" unknown type: %T\n", n)
	}

	return buf.Bytes()
}
903520
func (logger *Logger) Log(level log.Level, args ...interface{}) {
	logger.output(level, args...)
}
337699
func (cfg *cloudConfig) Output(kind OutputKind) (stdout, stderr string) {
	if out, ok := cfg.attrs["output"].(map[string]interface{}); ok {
		switch out := out[string(kind)].(type) {
		case string:
			stdout = out
		case []string:
			stdout, stderr = out[0], out[1]
		}
	}

	return stdout, stderr
}
1346709
func (m *Notify) Output(id types.CheckID) string {
	m.RLock()
	defer m.RUnlock()
	return m.output[id]
}
413680
func OutputWith(env map[string]string, cmd string, args ...string) (string, error) {
	buf := &bytes.Buffer{}
	_, err := Exec(env, buf, os.Stderr, cmd, args...)
	return strings.TrimSuffix(buf.String(), "\n"), err
}
124579
func (l *Logger) Print(args ...interface{}) {
	l.mu.Lock()
	defer l.mu.Unlock()
	fmt.Fprint(l.Out, args...)
}
397736
func (p FmtPrinter) Print(logger *Logger, a ...interface{}) {
	b := make([]interface{}, 1)
	b[0] = logger.Color(logger.Name)
	a = append(b, a...)
	fmt.Fprint(os.Stderr, a...)
}
418322
func (c *Console) consoleOutput(call otto.FunctionCall) otto.Value {
	var output []string
	for _, argument := range call.ArgumentList {
		output = append(output, fmt.Sprintf("%v", argument))
	}
	fmt.Fprintln(c.printer, strings.Join(output, " "))
	return otto.Value{}
}
1105770
func (l Logger) Output(w io.Writer) Logger {
	l2 := New(w)
	l2.level = l.level
	l2.sampler = l.sampler
	if len(l.hooks) > 0 {
		l2.hooks = append(l2.hooks, l.hooks...)
	}
	if l.context != nil {
		l2.context = make([]byte, len(l.context), cap(l.context))
		copy(l2.context, l.context)
	}
	return l2
}
181199
func Output(w io.Writer) ServiceOption {
	return func(s *Service) error {
		s.output = w
		return nil
	}
}
115418
func output(logLevel Level, content string, codeLevel int) string {
	if isStop {
		return ""
	}
	if len(content) == 0 {
		return ""
	}
	_, file, line, ok := runtime.Caller(codeLevel)
	lineInfo := "-:0"
	if ok {
		index := strings.Index(file, "/vendor/") + 7
		if index <7{
			index = strings.Index(file, "/src/") + 4
		}
		lineInfo = file[index:] + ":" + strconv.Itoa(line)
	}
	log := &logContent{time.Now(), logLevel, lineInfo, content}
	for _, filter := range filters {
		if filter != nil {
			filter.cache <- log
		}
	}
	return content
}
1056609
func (c *LogCmd) Output() ([]byte, error) {
	st := time.Now()
	data, err := c.Cmd.Output()
	if err != nil {
		ee, ok := err.(*exec.ExitError)
		if ok {
			c.log(st, err, ee.Stderr)
			return data, err
		}
	}
	c.log(st, err, nil)
	return data, err
}
477051
func (logger *Logger) AddOutput(uri string, classes ...LogClass) error {
	// generate it
	lo, err := createOutputWrapper(uri, classes)
	if err != nil {
		return err
	}
	if lo == nil {
		return nil
	}

	// Lock our outputs
	logger.outputMutex.Lock()
	defer logger.outputMutex.Unlock()
	logger.outputs = append(logger.outputs, lo)
	return nil
}