(prefix string)
| 190 | } |
| 191 | |
| 192 | func (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 | |
| 212 | func (s *StreamLogger) WithPrefixColor(prefix, color string) Logger { |
| 213 | s.m.Lock() |
nothing calls this directly
no test coverage detected