// NewOutput ...
559753
func NewOutput(data map[string]map[string]string, warnings ...string) WorkflowListOutputModel {
	return WorkflowListOutputModel{
		Data:     data,
		Warnings: warnings,
	}
}
149753
func (rd *RAMDirectory) CreateOutput(name string, context IOContext) (out IndexOutput, err error) {
	rd.EnsureOpen()
	file := rd.newRAMFile()
	rd.fileMapLock.Lock()
	defer rd.fileMapLock.Unlock()
	if existing, ok := rd.fileMap[name]; ok {
		atomic.AddInt64(&rd.sizeInBytes, -existing.sizeInBytes)
		existing.directory = nil
	}
	rd.fileMap[name] = file
	return NewRAMOutputStream(file, true), nil
}
1360021
func copyOutput(r io.Reader, doneCh chan<- struct{}) {
	defer close(doneCh)

	pr, err := prefixedio.NewReader(r)
	if err != nil {
		panic(err)
	}

	stderrR, err := pr.Prefix(ErrorPrefix)
	if err != nil {
		panic(err)
	}
	stdoutR, err := pr.Prefix(OutputPrefix)
	if err != nil {
		panic(err)
	}
	defaultR, err := pr.Prefix("")
	if err != nil {
		panic(err)
	}

	var wg sync.WaitGroup
	wg.Add(3)
	go func() {
		defer wg.Done()
		io.Copy(os.Stderr, stderrR)
	}()
	go func() {
		defer wg.Done()
		io.Copy(os.Stdout, stdoutR)
	}()
	go func() {
		defer wg.Done()
		io.Copy(os.Stdout, defaultR)
	}()

	wg.Wait()
}
334387
func (logger *Logger) ResetOutput() {
	logger.outputMutex.Lock()
	logger.outputs = make([]*loggerOutputWrapper, 0)
	logger.outputMutex.Unlock()
}
343003
func (c *Color) SetOutput(w io.Writer) {
	c.output = w
	if w, ok := w.(*os.File); !ok || !isatty.IsTerminal(w.Fd()) {
		c.disabled = true
	}
}
1257970
func NewUIDOutput(field string, o Output) Output {
	return OutputFunc(func(fields map[string]interface{}) error {
		fields[field] = xid.New().String()
		return o.Write(fields)
	})
}
1147041
func SetOutput(out io.Writer) {
	std = New(out, std.Prefix(), std.Flags(), std.priority)
}
1037545
func newOutputFuncFd(u *url.URL) (Output, error) {
	if u.User != nil {
		return nil, fmt.Errorf("Can not use a username with fd.")
	}
	if u.Path != "" {
		return nil, fmt.Errorf("Can not use a path with fd.")
	}
	if u.Fragment != "" {
		return nil, fmt.Errorf("Can not use a fragment with fd.")
	}

	// Parse the RawQuery so we can extract the format string.
	values, err := url.ParseQuery(u.RawQuery)
	if err != nil {
		return nil, err
	}

	// Get the values we need for setting up the Output object.
	format := values.Get("format")
	delete(values, "format")
	color := values.Get("color")
	delete(values, "color")

	// Check that nothing else was defined.
	if len(values) != 0 {
		bad := make([]string, 0, len(values))
		for k, _ := range values {
			bad = append(bad, k)
		}
		return nil, fmt.Errorf("Unknown parameters: %s", strings.Join(bad, ","))
	}

	// Parse the fd number from the host
	fd, err := strconv.Atoi(u.Host)
	if err != nil {
		return nil, fmt.Errorf("Invalid host specified, not a valid number.")
	}

	// open the fd
	file := os.NewFile(uintptr(fd), "log")

	// The output object we will return.
	return NewIOWriterOutput(file, format, color)
}
1307395
func (p *Printer) AddOutput(writers ...io.Writer) *Printer {
	p.mu.Lock()
	defer p.mu.Unlock()

	for _, w := range writers {
		// set is terminal to false
		// if at least one of the writers
		// is not a terminal-based.
		if !terminal.IsTerminal(w) {
			p.IsTerminal = false
			break
		}
	}

	w := io.MultiWriter(append(writers, p.Output)...)
	p.Output = w
	return p

	// p.mu.Lock()
	// oldW := p.Output
	// newW := io.MultiWriter(writers...)
	// p.Output = writerFunc(func(p []byte) (n int, err error) {
	// 	n, err = oldW.Write(p)
	// 	if err != nil {
	// 		return
	// 	}
	// 	if n != len(p) {
	// 		err = io.ErrShortWrite
	// 		return
	// 	}
	// 	return newW.Write(p)
	// })
	// p.mu.Unlock()
}
523027
func (s *SendTaskSuccessInput) SetOutput(v string) *SendTaskSuccessInput {
	s.Output = &v
	return s
}
625602
func newOutputFuncStderr(u *url.URL) (Output, error) {
	if u.User != nil {
		return nil, fmt.Errorf("Can not use a username with stderr.")
	}
	if u.Host != "" {
		return nil, fmt.Errorf("Can not use a hostname with stderr.")
	}
	if u.Path != "" {
		return nil, fmt.Errorf("Can not use a path with stderr.")
	}
	if u.Fragment != "" {
		return nil, fmt.Errorf("Can not use a fragment with stderr.")
	}

	// Parse the RawQuery so we can extract the format string.
	values, err := url.ParseQuery(u.RawQuery)
	if err != nil {
		return nil, err
	}

	// Get the values we need for setting up the Output object.
	format := values.Get("format")
	delete(values, "format")
	color := values.Get("color")
	delete(values, "color")

	// Check that nothing else was defined.
	if len(values) != 0 {
		bad := make([]string, 0, len(values))
		for k, _ := range values {
			bad = append(bad, k)
		}
		return nil, fmt.Errorf(
			"Unknown parameters: %s", strings.Join(bad, ","))
	}

	// The output object we will return.
	return NewIOWriterOutput(os.Stderr, format, color)
}
495440
func newOutputGadget(config *GadgetConfig) (gadget *Gadget, err error) {
	dev, err := NewOutputDevice(&config.Pin)
	if err != nil {
		panic(err)
	}

	if cmds := dev.Commands(config.Location, config.Name); cmds != nil {
		config.OnCommands = cmds.On
		config.OffCommands = cmds.Off
	} else {
		if len(config.OnCommands) == 0 {
			config.OnCommands = []string{fmt.Sprintf("turn on %s %s", config.Location, config.Name)}
		}
		if len(config.OffCommands) == 0 {
			config.OffCommands = []string{fmt.Sprintf("turn off %s %s", config.Location, config.Name)}
		}
	}
	gadget = &Gadget{
		Type:           config.Pin.Type,
		Location:       config.Location,
		Name:           config.Name,
		Direction:      "output",
		OnCommands:     config.OnCommands,
		OffCommands:    config.OffCommands,
		InitialValue:   config.InitialValue,
		Output:         dev,
		Operator:       ">=",
		UID:            fmt.Sprintf("%s %s", config.Location, config.Name),
		filterMessages: config.Pin.Type != "recorder" && config.Pin.Type != "alarm",
	}
	return gadget, nil
}
1185550
func (logger *Logger) UpdateOutput(uri string, classes ...LogClass) error {

	u, err := url.Parse(uri)
	if err != nil {
		return err
	}

	class := NONE
	for _, c := range classes {
		class |= c
	}

	newoutputs := make([]*loggerOutputWrapper, 0)
	// Lock our outputs
	logger.outputMutex.Lock()
	defer logger.outputMutex.Unlock()
	for i, o := range logger.outputs {
		if (o.Class == class || o.Class&class != 0) && u.Scheme == o.OutputWrapper.URL.Scheme {
			// Found a match

			// generate it with new uri for intersection of given classes and output's classes.
			lo, err := createOutputWrapperForClass(uri, o.Class&class)
			if err != nil {
				return err
			}
			if lo == nil {
				continue
			}

			logger.outputs[i] = lo

			// Save this output for rest of the classes not being updated.
			// Add these later outside the loop so that these are not updated.
			restClasses := (o.Class ^ class) & o.Class
			if restClasses != NONE && restClasses != isPLUSDEF {
				o.Class = restClasses
				newoutputs = append(newoutputs, o)
			}
		}
	}

	logger.outputs = append(logger.outputs, newoutputs...)

	return nil
}
854374
func NewActionOutput(portNum uint32) *ActionOutput {
	act := new(ActionOutput)
	act.Type = ActionType_Output
	act.Length = act.Len()
	act.Port = portNum
	act.MaxLen = 256
	act.pad = make([]byte, 6)
	return act
}
1273656
func (l *Log) ChangeOutput(output io.Writer) {
	l.deflogger.SetOutput(output)
}
1146993
func streamOutput(src io.Reader, dst *bytes.Buffer, out io.Writer) error {
	mw := io.MultiWriter(dst, out)
	s := bufio.NewReader(src)
	for {
		var line []byte
		line, err := s.ReadSlice('\n')
		if err == io.EOF && len(line) == 0 {
			break // done
		}
		if err == io.EOF {
			return fmt.Errorf("Improper termination: %v", line)
		}
		if err != nil {
			return err
		}

		// append to the buffer and out at once
		mw.Write(line)
	}

	return nil
}
1136188
func (n *UnCompiledNode) prependOutput(outputPrefix interface{}) {
	for arcIdx := 0; arcIdx < n.NumArcs; arcIdx++ {
		n.Arcs[arcIdx].output = n.owner.fst.outputs.Add(outputPrefix, n.Arcs[arcIdx].output)
	}

	if n.IsFinal {
		n.output = n.owner.fst.outputs.Add(outputPrefix, n.output)
	}
}