detached f79d84b

chore(logging): remove excessive debug spam from omnibox suggestions

Removed 8 DEBUG log statements that fired on every keystroke:
- Handling query message
- handleQuery called
- Searching history
- Found X history entries
- History entry details
- Final results count
- Injecting omnibox suggestions
- Successfully injected

Also removed ERROR/WARN logs for nil checks that are now early returns.
Silent operation unless actual errors occur - KISS principle.
commit
f79d84b3af66e3cef799cca561787d6b8d1a9f87
author
bnema · · 2025-10-24 05:37 UTC
committer
bnema · · 2025-10-24 17:33 UTC
parent
3f362d6
signature
GPG Unverified2B82207D370127A0 The key is unknown
2 files · +6 -26
M internal/app/messaging/handler.go +5 -26
@@ -82,9 +82,7 @@ func (h *Handler) Handle(payload string) {
8282 case "navigate":
8383 h.handleNavigation(msg)
8484 case "query":
85- log.Printf("[DEBUG] Handling query message: q=%s, limit=%d", msg.Q, msg.Limit)
8685 if h.webView == nil {
87- log.Printf("[WARN] Dropping query response: webview unavailable for suggestions")
8886 return
8987 }
9088 h.handleQuery(msg)
@@ -200,13 +198,7 @@ func (h *Handler) handleClosePopup(msg Message) {
200198 }
201199
202200 func (h *Handler) handleQuery(msg Message) {
203- if h.webView == nil {
204- log.Printf("[WARN] Skipping query handling: webview is nil")
205- return
206- }
207- log.Printf("[DEBUG] handleQuery called: q='%s', limit=%d", msg.Q, msg.Limit)
208- if h.browserService == nil {
209- log.Printf("[ERROR] handleQuery: browserService is nil")
201+ if h.webView == nil || h.browserService == nil {
210202 return
211203 }
212204 ctx := context.Background()
@@ -233,12 +225,8 @@ func (h *Handler) handleQuery(msg Message) {
233225 // History
234226 if len(results) < limit {
235227 remaining := limit - len(results)
236- log.Printf("[DEBUG] Searching history for '%s' with limit %d", q, remaining)
237- if entries, err := h.browserService.SearchHistory(ctx, q, remaining); err != nil {
238- log.Printf("[ERROR] Failed to search history: %v", err)
239- } else {
240- log.Printf("[DEBUG] Found %d history entries", len(entries))
241- for i, e := range entries {
228+ if entries, err := h.browserService.SearchHistory(ctx, q, remaining); err == nil {
229+ for _, e := range entries {
242230 // JSON roundtrip to map to get url field agnostic of struct tag
243231 bb, _ := json.Marshal(e)
244232 var m map[string]any
@@ -249,7 +237,6 @@ func (h *Handler) handleQuery(msg Message) {
249237 } else if s, ok := m["URL"].(string); ok {
250238 url = s
251239 }
252- log.Printf("[DEBUG] History entry %d: url=%s", i, url)
253240 if url == "" {
254241 continue
255242 }
@@ -271,18 +258,10 @@ func (h *Handler) handleQuery(msg Message) {
271258 }
272259
273260 // Inject back to GUI
274- log.Printf("[DEBUG] Final results count: %d", len(results))
275- if b, err := json.Marshal(results); err != nil {
276- log.Printf("[ERROR] Failed to marshal results: %v", err)
277- } else {
261+ if b, err := json.Marshal(results); err == nil {
278262 // Prefer unified page-world API; fallback to legacy global function
279263 script := "(window.__dumber?.omnibox?.suggestions ? window.__dumber.omnibox.suggestions(" + string(b) + ") : (window.__dumber_omnibox_suggestions && window.__dumber_omnibox_suggestions(" + string(b) + ")))"
280- log.Print("[DEBUG] Injecting omnibox suggestions")
281- if injErr := h.webView.InjectScript(script); injErr != nil {
282- log.Printf("[ERROR] Failed to inject suggestions script: %v", injErr)
283- } else {
284- log.Printf("[DEBUG] Successfully injected omnibox suggestions")
285- }
264+ h.webView.InjectScript(script)
286265 }
287266 }
288267
@@ -82,9 +82,7 @@ func (h *Handler) Handle(payload string) {
82 case "navigate":82 case "navigate":
83 h.handleNavigation(msg)83 h.handleNavigation(msg)
84 case "query":84 case "query":
85- log.Printf("[DEBUG] Handling query message: q=%s, limit=%d", msg.Q, msg.Limit)
86 if h.webView == nil {85 if h.webView == nil {
87- log.Printf("[WARN] Dropping query response: webview unavailable for suggestions")
88 return86 return
89 }87 }
90 h.handleQuery(msg)88 h.handleQuery(msg)
@@ -200,13 +198,7 @@ func (h *Handler) handleClosePopup(msg Message) {
200 }198 }
201 199
202 func (h *Handler) handleQuery(msg Message) {200 func (h *Handler) handleQuery(msg Message) {
203- if h.webView == nil {201+ if h.webView == nil || h.browserService == nil {
204- log.Printf("[WARN] Skipping query handling: webview is nil")
205- return
206- }
207- log.Printf("[DEBUG] handleQuery called: q='%s', limit=%d", msg.Q, msg.Limit)
208- if h.browserService == nil {
209- log.Printf("[ERROR] handleQuery: browserService is nil")
210 return202 return
211 }203 }
212 ctx := context.Background()204 ctx := context.Background()
@@ -233,12 +225,8 @@ func (h *Handler) handleQuery(msg Message) {
233 // History225 // History
234 if len(results) < limit {226 if len(results) < limit {
235 remaining := limit - len(results)227 remaining := limit - len(results)
236- log.Printf("[DEBUG] Searching history for '%s' with limit %d", q, remaining)228+ if entries, err := h.browserService.SearchHistory(ctx, q, remaining); err == nil {
237- if entries, err := h.browserService.SearchHistory(ctx, q, remaining); err != nil {229+ for _, e := range entries {
238- log.Printf("[ERROR] Failed to search history: %v", err)
239- } else {
240- log.Printf("[DEBUG] Found %d history entries", len(entries))
241- for i, e := range entries {
242 // JSON roundtrip to map to get url field agnostic of struct tag230 // JSON roundtrip to map to get url field agnostic of struct tag
243 bb, _ := json.Marshal(e)231 bb, _ := json.Marshal(e)
244 var m map[string]any232 var m map[string]any
@@ -249,7 +237,6 @@ func (h *Handler) handleQuery(msg Message) {
249 } else if s, ok := m["URL"].(string); ok {237 } else if s, ok := m["URL"].(string); ok {
250 url = s238 url = s
251 }239 }
252- log.Printf("[DEBUG] History entry %d: url=%s", i, url)
253 if url == "" {240 if url == "" {
254 continue241 continue
255 }242 }
@@ -271,18 +258,10 @@ func (h *Handler) handleQuery(msg Message) {
271 }258 }
272 259
273 // Inject back to GUI260 // Inject back to GUI
274- log.Printf("[DEBUG] Final results count: %d", len(results))261+ if b, err := json.Marshal(results); err == nil {
275- if b, err := json.Marshal(results); err != nil {
276- log.Printf("[ERROR] Failed to marshal results: %v", err)
277- } else {
278 // Prefer unified page-world API; fallback to legacy global function262 // Prefer unified page-world API; fallback to legacy global function
279 script := "(window.__dumber?.omnibox?.suggestions ? window.__dumber.omnibox.suggestions(" + string(b) + ") : (window.__dumber_omnibox_suggestions && window.__dumber_omnibox_suggestions(" + string(b) + ")))"263 script := "(window.__dumber?.omnibox?.suggestions ? window.__dumber.omnibox.suggestions(" + string(b) + ") : (window.__dumber_omnibox_suggestions && window.__dumber_omnibox_suggestions(" + string(b) + ")))"
280- log.Print("[DEBUG] Injecting omnibox suggestions")264+ h.webView.InjectScript(script)
281- if injErr := h.webView.InjectScript(script); injErr != nil {
282- log.Printf("[ERROR] Failed to inject suggestions script: %v", injErr)
283- } else {
284- log.Printf("[DEBUG] Successfully injected omnibox suggestions")
285- }
286 }265 }
287 }266 }
288 267
M pkg/webkit/webview.go +1 -0
@@ -6,6 +6,7 @@ import (
66 "log"
77 "strconv"
88 "sync"
9+ "sync/atomic"
910
1011 webkit "github.com/diamondburned/gotk4-webkitgtk/pkg/webkit/v6"
1112 "github.com/diamondburned/gotk4/pkg/gdk/v4"
@@ -6,6 +6,7 @@ import (
6 "log"6 "log"
7 "strconv"7 "strconv"
8 "sync"8 "sync"
9+ "sync/atomic"
9 10
10 webkit "github.com/diamondburned/gotk4-webkitgtk/pkg/webkit/v6"11 webkit "github.com/diamondburned/gotk4-webkitgtk/pkg/webkit/v6"
11 "github.com/diamondburned/gotk4/pkg/gdk/v4"12 "github.com/diamondburned/gotk4/pkg/gdk/v4"

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 8

Tags 42

↑↓ moveenter openesc close