func (tr *tracer) Traces() Traces {
	return tr.traces
}
Traces returns the collected tracing logs.
package hangulize
import (
	"bytes"
	"fmt"
	"io"
	"strings"
	runewidth "github.com/mattn/go-runewidth"
	"github.com/hangulize/hangulize/internal/subword"
)
type Trace struct {
	Step Step
	Word string
	Why string
	Rule    Rule
	HasRule bool
}
func newTrace(step Step, word string, why string, rule *Rule) Trace {
	var _rule Rule
	var hasRule bool
	if rule != nil {
		_rule = *rule
		hasRule = true
	}
	return Trace{step, word, why, _rule, hasRule}
}
func (t Trace) String() string {
	var buf bytes.Buffer
	fmt.Fprintf(&buf, "[%s] %#v", t.Step, t.Word)
	if t.HasRule {
		fmt.Fprintf(&buf, " | %s", t.Rule)
	} else if t.Why != "" {
		fmt.Fprintf(&buf, " | (%s)", t.Why)
	}
	return buf.String()
}
type Traces []Trace
func (ts Traces) Render(w io.Writer) {
	var width, maxWidth int
	widths := make([]int, len(ts))
	for i, t := range ts {
		width = runewidth.StringWidth(t.Word)
		widths[i] = width
		if maxWidth < width {
			maxWidth = width
		}
	}
	var step Step
	for i, t := range ts {
		if step != t.Step {
			step = t.Step
			fmt.Fprintf(w, "[%s]\n", step)
		}
		fmt.Fprintf(w, "  %s", t.Word)
		fmt.Fprintf(w, strings.Repeat(" ", maxWidth-widths[i]))
		if t.HasRule {
			fmt.Fprintf(w, " | %s", t.Rule)
		} else if t.Why != "" {
			fmt.Fprintf(w, " | (%s)", t.Why)
		}
		fmt.Fprintf(w, "\n")
	}
}
type tracer struct {
	traces   Traces
	lastWord string
}