// For printing all operationgs to the console for debugging.
760212
func NewDebugDB(label string, db DB) debugDB {
	return debugDB{
		label: label,
		db:    db,
	}
}
780045
func (l *Log) Print(args ...interface{}) {
	if l.loadCustomLogger() {
		l.customLogger.Print(args...)
		return
	}
	l.deflogger.Print(args...)
}
452622
func (o *TextOutput) Println(msg string) {
	if o.enabled {
		fmt.Println(msg)
	}
}
589888
func Print(a ...interface{}) (n int, err error) {
	return fmt.Fprint(out, formatAll(a)...)
}
688729
func (dbg DebugPrinter) Print(v ...interface{}) {
	if dbg.Enabled {
		fmt.Fprint(dbg.out, v...)
	}
}
967572
func Debugf(format string, v ...interface{}) {
	std.Fprint(std.flags, LEVEL_DEBUG, 2, fmt.Sprintf(format, v...), nil)
}
549895
func PrintArray(m interface{}) string {
	var outputText string

	switch reflect.TypeOf(m).Kind() {
	case reflect.Slice:
		var xs []string

		slice := reflect.ValueOf(m)
		for i := 0; i < slice.Len(); i++ {
			xs = append(xs, fmt.Sprintf("[%d]=%s", i, slice.Index(i)))
		}

		if len(xs) == 0 {
			outputText = "len(array) == 0"
		} else {
			outputText = strings.Join(xs, "\n")
		}
	default:
		outputText = fmt.Sprintf("error while printing array\nreceived a %T\n  %s\n", m, m)
	}

	return outputText
}
431840
func PrintSuccess(mapper meta.RESTMapper, shortOutput bool, out io.Writer, resource string, name string, operation string) {
	resource, _ = mapper.ResourceSingularizer(resource)
	if shortOutput {
		// -o name: prints resource/name
		if len(resource) > 0 {
			fmt.Fprintf(out, "%s/%s\n", resource, name)
		} else {
			fmt.Fprintf(out, "%s\n", name)
		}
	} else {
		// understandable output by default
		if len(resource) > 0 {
			fmt.Fprintf(out, "%s \"%s\" %s\n", resource, name, operation)
		} else {
			fmt.Fprintf(out, "\"%s\" %s\n", name, operation)
		}
	}
}
355959
func (rm *RoleManager) PrintRoles() error {
	line := ""
	rm.allRoles.Range(func(_, value interface{}) bool {
		if text := value.(*Role).toString(); text != "" {
			if line == "" {
				line = text
			} else {
				line += ", " + text
			}
		}
		return true
	})
	log.LogPrint(line)
	return nil
}
471741
func (cmd *PageCommand) PrintBranch(w io.Writer, buf []byte) error {
	p := (*page)(unsafe.Pointer(&buf[0]))

	// Print number of items.
	fmt.Fprintf(w, "Item Count: %d\n", p.count)
	fmt.Fprintf(w, "\n")

	// Print each key/value.
	for i := uint16(0); i < p.count; i++ {
		e := p.branchPageElement(i)

		// Format key as string.
		var k string
		if isPrintable(string(e.key())) {
			k = fmt.Sprintf("%q", string(e.key()))
		} else {
			k = fmt.Sprintf("%x", string(e.key()))
		}

		fmt.Fprintf(w, "%s: <pgid=%d>\n", k, e.pgid)
	}
	fmt.Fprintf(w, "\n")
	return nil
}
277077
func (ds *DummyStatus) PrintMsg(msg message) {
	if !globalJSON {
		console.Println(msg.String())
	} else {
		console.Println(msg.JSON())
	}
}
733428
func (p *Progress) Print(optionals ...bool) {
	stream := os.Stderr
	if len(optionals) > 0 {
		if optionals[0] {
			stream = os.Stdout
		}
	}
	f := bufio.NewWriter(stream)
	defer f.Flush()
	f.WriteString(fmt.Sprintf("% *s\r", p.sOutput, ""))
	f.WriteString(p.String() + "\r")
}
598953
func batchOps(done <-chan struct{}, ops <-chan map[string]interface{}) <-chan []interface{} {
	c := make(chan []interface{})

	go func() {
		defer close(c)
		// In a loop grab as many elements as you can before you would block (the default case)
		// Only place non-empty batches into the output channel.
		elements := make([]interface{}, 0)

		// Send the current list of elements as a batch, unless it's empty. Returns whether or not a batch was sent.
		sendElements := func() bool {
			if len(elements) == 0 {
				return false
			}
			select {
			case c <- elements:
				elements = make([]interface{}, 0)
			case <-done:
			}
			return true
		}

		for {
			select {
			case elem, channelOpen := <-ops:
				if !channelOpen {
					sendElements()
					return
				}
				elements = append(elements, elem)
			default:
				if !sendElements() {
					// stop from busy-wait eating all cpu.
					time.Sleep(1 * time.Millisecond)
				}
			}
		}
	}()
	return c
}
1066377
func printVMs(tsv bool, vms ...*crimson.VM) {
	if len(vms) > 0 {
		p := newStdoutPrinter(tsv)
		defer p.Flush()
		if !tsv {
			p.Row("Name", "VLAN", "IP Address", "Host", "Host VLAN", "Operating System", "Description", "Deployment Ticket", "State")
		}
		for _, vm := range vms {
			p.Row(vm.Name, vm.Vlan, vm.Ipv4, vm.Host, vm.HostVlan, vm.Os, vm.Description, vm.DeploymentTicket, vm.State)
		}
	}
}
275286
func getAllCommands() string {
	commands := ""
	for _, c := range validCommands {
		commands += fmt.Sprintf("    <yellow>%-16s</yellow> %s\n", c.name, c.description)
	}
	return commands
}
1123203
func (a *API) OperationNames() []string {
	i, names := 0, make([]string, len(a.Operations))
	for n := range a.Operations {
		names[i] = n
		i++
	}
	sort.Strings(names)
	return names
}
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{}
}