MCPcopy Create free account
hub / github.com/chainreactors/EvilProxy / renderLogs

Method renderLogs

internal/tui/logs_tab.go:191–232  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

189}
190
191func (m logsTabModel) renderLogs() string {
192 var sb strings.Builder
193
194 scrollStatus := successStyle.Render(T("logs_auto_scroll"))
195 if !m.autoScroll {
196 scrollStatus = warningStyle.Render(T("logs_paused"))
197 }
198 filterLabel := "ALL"
199 if m.filter != "" {
200 filterLabel = strings.ToUpper(m.filter) + "+"
201 }
202
203 header := fmt.Sprintf(" %s %s %s: %s %s: %d",
204 T("logs_title"), scrollStatus, T("logs_filter"), filterLabel, T("logs_lines"), len(m.lines))
205 sb.WriteString(titleStyle.Render(header))
206 sb.WriteString("\n")
207 sb.WriteString(helpStyle.Render(T("logs_help")))
208 sb.WriteString("\n")
209 sb.WriteString(strings.Repeat("─", m.width))
210 sb.WriteString("\n")
211
212 if m.lastErr != nil {
213 sb.WriteString(errorStyle.Render("⚠ Error: " + m.lastErr.Error()))
214 sb.WriteString("\n")
215 }
216
217 if len(m.lines) == 0 {
218 sb.WriteString(subtitleStyle.Render(T("logs_waiting")))
219 return sb.String()
220 }
221
222 for _, line := range m.lines {
223 if m.filter != "" && !m.matchLevel(line) {
224 continue
225 }
226 styled := m.styleLine(line)
227 sb.WriteString(styled)
228 sb.WriteString("\n")
229 }
230
231 return sb.String()
232}
233
234func (m logsTabModel) matchLevel(line string) bool {
235 switch m.filter {

Callers 2

UpdateMethod · 0.95
SetSizeMethod · 0.95

Calls 6

matchLevelMethod · 0.95
styleLineMethod · 0.95
TFunction · 0.85
WriteStringMethod · 0.80
ErrorMethod · 0.45
StringMethod · 0.45

Tested by

no test coverage detected