summaryrefslogtreecommitdiff
path: root/internal/clients
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2021-09-06 09:22:21 +0300
committerPaul Buetow <paul@buetow.org>2021-09-06 09:22:21 +0300
commit2c1c70313bb03cf2b2d7e7afadb07a48ff6bb690 (patch)
tree2ea3402bc6dd2d3e3ce0754eb3d5c90305e87c2e /internal/clients
parentc895b3c8293ddbf46d66278061d7e0127adc57f7 (diff)
REMOTE and CLIENT colors are brushed correctly too now
Diffstat (limited to 'internal/clients')
-rw-r--r--internal/clients/stats.go14
1 files changed, 10 insertions, 4 deletions
diff --git a/internal/clients/stats.go b/internal/clients/stats.go
index d8163d4..3f76e0f 100644
--- a/internal/clients/stats.go
+++ b/internal/clients/stats.go
@@ -8,6 +8,7 @@ import (
"sync"
"time"
+ "github.com/mimecast/dtail/internal/color"
"github.com/mimecast/dtail/internal/config"
"github.com/mimecast/dtail/internal/io/logger"
)
@@ -54,7 +55,6 @@ func (s *stats) Start(ctx context.Context, throttleCh <-chan struct{}, statsCh <
throttle := len(throttleCh)
newConnections := connected - connectedLast
-
if (connected == connectedLast || quiet) && !force {
continue
}
@@ -77,7 +77,15 @@ func (s *stats) Start(ctx context.Context, throttleCh <-chan struct{}, statsCh <
func (s *stats) printStatsDueInterrupt(messages []string) {
logger.Pause()
- for _, message := range messages {
+ for i, message := range messages {
+ if i > 0 && config.Client.TermColorsEnable {
+ fmt.Println(color.PaintStrWithAttr(message,
+ config.Client.TermColors.Client.TextFg,
+ config.Client.TermColors.Client.TextBg,
+ config.Client.TermColors.Client.TextAttr,
+ ))
+ continue
+ }
fmt.Println(fmt.Sprintf(" %s", message))
}
time.Sleep(time.Second * time.Duration(config.InterruptTimeoutS))
@@ -99,7 +107,6 @@ func (s *stats) statsLine(connected, newConnections int, throttle int) string {
func (s *stats) numConnected() int {
s.mutex.Lock()
defer s.mutex.Unlock()
-
return s.connected
}
@@ -107,6 +114,5 @@ func percentOf(total float64, value float64) float64 {
if total == 0 || total == value {
return 100
}
-
return value / (total / 100.0)
}