MCPcopy Create free account
hub / github.com/devspace-sh/devspace / WithPrefix

Method WithPrefix

pkg/util/log/stream_logger.go:192–210  ·  view source on GitHub ↗
(prefix string)

Source from the content-addressed store, hash-verified

190}
191
192func (s *StreamLogger) WithPrefix(prefix string) Logger {
193 s.m.Lock()
194 defer s.m.Unlock()
195
196 hashNumber := int(hash.StringToNumber(prefix))
197 if hashNumber < 0 {
198 hashNumber = hashNumber * -1
199 }
200
201 n := *s
202 n.m = &sync.Mutex{}
203 n.prefixes = []Prefix{}
204 n.prefixes = append(n.prefixes, s.prefixes...)
205 n.prefixes = append(n.prefixes, Prefix{
206 Prefix: prefix,
207 Color: Colors[hashNumber%len(Colors)],
208 })
209 return &n
210}
211
212func (s *StreamLogger) WithPrefixColor(prefix, color string) Logger {
213 s.m.Lock()

Callers

nothing calls this directly

Calls 3

StringToNumberFunction · 0.92
LockMethod · 0.80
UnlockMethod · 0.80

Tested by

no test coverage detected