mirror of https://github.com/databricks/cli.git
keep printing attrs
This commit is contained in:
parent
667876d78c
commit
6c203fb957
|
@ -188,29 +188,33 @@ func (h *friendlyHandler) Handle(ctx context.Context, r slog.Record) error {
|
||||||
state.appendf("%s ", h.coloredLevel(r))
|
state.appendf("%s ", h.coloredLevel(r))
|
||||||
state.append(h.sprint(ttyColorMessage, r.Message))
|
state.append(h.sprint(ttyColorMessage, r.Message))
|
||||||
|
|
||||||
// Handle state from WithGroup and WithAttrs.
|
if h.opts.Level.Level() <= slog.LevelDebug {
|
||||||
goas := h.goas
|
|
||||||
if r.NumAttrs() == 0 {
|
// Handle state from WithGroup and WithAttrs.
|
||||||
// If the record has no Attrs, remove groups at the end of the list; they are empty.
|
goas := h.goas
|
||||||
for len(goas) > 0 && goas[len(goas)-1].group != "" {
|
if r.NumAttrs() == 0 {
|
||||||
goas = goas[:len(goas)-1]
|
// If the record has no Attrs, remove groups at the end of the list; they are empty.
|
||||||
}
|
for len(goas) > 0 && goas[len(goas)-1].group != "" {
|
||||||
}
|
goas = goas[:len(goas)-1]
|
||||||
for _, goa := range goas {
|
}
|
||||||
if goa.group != "" {
|
}
|
||||||
state.openGroup(goa.group)
|
for _, goa := range goas {
|
||||||
} else {
|
if goa.group != "" {
|
||||||
for _, a := range goa.attrs {
|
state.openGroup(goa.group)
|
||||||
state.appendAttr(a)
|
} else {
|
||||||
|
for _, a := range goa.attrs {
|
||||||
|
state.appendAttr(a)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Add attributes from the record.
|
// Add attributes from the record.
|
||||||
r.Attrs(func(a slog.Attr) bool {
|
r.Attrs(func(a slog.Attr) bool {
|
||||||
state.appendAttr(a)
|
state.appendAttr(a)
|
||||||
return true
|
return true
|
||||||
})
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
// Add newline.
|
// Add newline.
|
||||||
state.append("\n")
|
state.append("\n")
|
||||||
|
|
Loading…
Reference in New Issue