()
| 144 | } |
| 145 | |
| 146 | func (v *LogView) typeDesc() (typ, desc string) { |
| 147 | chunks := strings.Split(v.TypeName(), "(") |
| 148 | |
| 149 | // NOTE(cyx): Some logs don't have a typ at all -- for those we'll |
| 150 | // provide some indicator that it's empty so it's not as surprising. |
| 151 | typ = chunks[0] |
| 152 | if typ == "" { |
| 153 | typ = "..." |
| 154 | } |
| 155 | |
| 156 | typ = truncate(chunks[0], 23) |
| 157 | |
| 158 | if len(chunks) == 2 { |
| 159 | desc = strings.TrimSuffix(chunks[1], ")") |
| 160 | } |
| 161 | |
| 162 | desc = fmt.Sprintf("%s %s", desc, auth0.StringValue(v.Description)) |
| 163 | |
| 164 | switch v.category() { |
| 165 | case logCategorySuccess: |
| 166 | typ = ansi.Green(typ) |
| 167 | case logCategoryFailure: |
| 168 | typ = ansi.BrightRed(typ) |
| 169 | case logCategoryWarning: |
| 170 | typ = ansi.BrightYellow(typ) |
| 171 | default: |
| 172 | typ = ansi.Faint(typ) |
| 173 | } |
| 174 | |
| 175 | return typ, desc |
| 176 | } |
| 177 | |
| 178 | func (r *Renderer) LogPrompt(logs []*management.Log, currentIndex *int) string { |
| 179 | resource := "logs" |
no test coverage detected