diff options
| author | Paul Buetow <paul@buetow.org> | 2021-09-07 10:01:32 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2021-09-07 10:01:32 +0300 |
| commit | f74a9e4b35feb8c07d8a70b5a581088a0a59889d (patch) | |
| tree | 62ebcc6314ec70270416a4416579878b82135fce /internal/color | |
| parent | 6ae75e8f106d3eee18ea61e6c4d6925c6f514460 (diff) | |
Produce MAPREDUCE lines, can aggregate these via default log format
Diffstat (limited to 'internal/color')
| -rw-r--r-- | internal/color/brush/brush.go | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/internal/color/brush/brush.go b/internal/color/brush/brush.go index 524829b..82fa410 100644 --- a/internal/color/brush/brush.go +++ b/internal/color/brush/brush.go @@ -5,6 +5,7 @@ import ( "github.com/mimecast/dtail/internal/color" "github.com/mimecast/dtail/internal/config" + "github.com/mimecast/dtail/internal/io/pool" "github.com/mimecast/dtail/internal/protocol" ) @@ -171,20 +172,21 @@ func paintServer(sb *strings.Builder, line string) { // Colorfy a given line based on the line's content. func Colorfy(line string) string { - sb := strings.Builder{} + sb := pool.BuilderBuffer.Get().(*strings.Builder) + defer pool.RecycleBuilderBuffer(sb) switch { case strings.HasPrefix(line, "REMOTE"): - paintRemote(&sb, line) + paintRemote(sb, line) case strings.HasPrefix(line, "CLIENT"): - paintClient(&sb, line) + paintClient(sb, line) case strings.HasPrefix(line, "SERVER"): - paintServer(&sb, line) + paintServer(sb, line) default: - color.PaintWithAttr(&sb, line, + color.PaintWithAttr(sb, line, color.FgDefault, color.BgDefault, color.AttrNone) |
