handlers/cli/cli.go
func (h *Handler) HandleLog(e *log.Entry) error {
	color := Colors[e.Level]
	level := Strings[e.Level]

	var fields []field

	for k, v := range e.Fields {
		fields = append(fields, field{k, v})
	}

	sort.Sort(byName(fields))

	h.mu.Lock()
	defer h.mu.Unlock()

	if h.UseColor {
		fmt.Fprintf(h.Writer, "\033[%dm%6s\033[0m %-40s", color, level, e.Message)
	} else {
		fmt.Fprintf(h.Writer, "%6s %-40s", level, e.Message)
	}

	for _, f := range fields {
		var value interface{}
		switch t := f.Value.(type) {
		case []byte: // addresses and EUIs are []byte
			value = fmt.Sprintf("%X", t)
		case [21]byte: // bundle IDs [21]byte
			value = fmt.Sprintf("%X-%X-%X-%X", t[0], t[1:9], t[9:17], t[17:])
		default:
			value = f.Value
		}

		if h.UseColor {
			fmt.Fprintf(h.Writer, " \033[%dm%s\033[0m=%v", color, f.Name, value)
		} else {
			fmt.Fprintf(h.Writer, " %s=%v", f.Name, value)
		}

	}

	fmt.Fprintln(h.Writer)

	return nil
}
func (h *Handler) HandleLog(e *log.Entry) error {
	color := Colors[e.Level]
	level := Strings[e.Level]

	var fields []field

	for k, v := range e.Fields {
		fields = append(fields, field{k, v})
	}

	sort.Sort(byName(fields))

	h.mu.Lock()
	defer h.mu.Unlock()

	if h.UseColor {
		fmt.Fprintf(h.Writer, "\033[%dm%6s\033[0m %-40s", color, level, e.Message)
	} else {
		fmt.Fprintf(h.Writer, "%6s %-40s", level, e.Message)
	}

	for _, f := range fields {
		var value interface{}
		switch t := f.Value.(type) {
		case []byte: // addresses and EUIs are []byte
			value = fmt.Sprintf("%X", t)
		case [21]byte: // bundle IDs [21]byte
			value = fmt.Sprintf("%X-%X-%X-%X", t[0], t[1:9], t[9:17], t[17:])
		default:
			value = f.Value
		}

		if h.UseColor {
			fmt.Fprintf(h.Writer, " \033[%dm%s\033[0m=%v", color, f.Name, value)
		} else {
			fmt.Fprintf(h.Writer, " %s=%v", f.Name, value)
		}

	}

	fmt.Fprintln(h.Writer)

	return nil
}
// HandleLog implements log.Handler.