mirror of
https://github.com/amir20/dozzle.git
synced 2026-06-23 04:10:12 +00:00
51e13d5f97
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
22 lines
683 B
Go
22 lines
683 B
Go
package container
|
|
|
|
import "strings"
|
|
|
|
// PlainText renders a log event as plain text for clipboard copy, stripping
|
|
// ANSI escape sequences. Grouped events carry their lines in fragments and
|
|
// have an empty RawMessage, so they are expanded one line per fragment;
|
|
// otherwise every grouped multi-line entry collapses to a single blank line on
|
|
// copy.
|
|
func (e *LogEvent) PlainText() string {
|
|
if e.Type == LogTypeGroup {
|
|
if fragments, ok := e.Message.([]LogFragment); ok {
|
|
lines := make([]string, len(fragments))
|
|
for i, fragment := range fragments {
|
|
lines[i] = StripANSI(fragment.Message)
|
|
}
|
|
return strings.Join(lines, "\n")
|
|
}
|
|
}
|
|
return StripANSI(e.RawMessage)
|
|
}
|