From 39664a734dbc6f8da3233b1eaeca417812214d55 Mon Sep 17 00:00:00 2001 From: jamesread Date: Thu, 6 Nov 2025 23:42:07 +0000 Subject: [PATCH] fix: Various log noise --- service/internal/acl/acl.go | 9 ++++++++- service/internal/api/api.go | 6 ++++-- service/internal/executor/executor_actions.go | 4 +++- service/internal/httpservers/singleFrontend.go | 6 +++++- service/internal/httpservers/webuiServer.go | 2 +- service/main.go | 13 ++++++++++--- 6 files changed, 31 insertions(+), 9 deletions(-) diff --git a/service/internal/acl/acl.go b/service/internal/acl/acl.go index 59c3358..227e537 100644 --- a/service/internal/acl/acl.go +++ b/service/internal/acl/acl.go @@ -208,12 +208,19 @@ func UserFromContext[T any](ctx context.Context, req *connect.Request[T], cfg *c } else { buildUserAcls(cfg, &user) } + + path := "" + if req != nil { + path = req.Spec().Procedure + } + log.WithFields(log.Fields{ "username": user.Username, "usergroupLine": user.UsergroupLine, "provider": user.Provider, "acls": user.Acls, - }).Debugf("UserFromContext") + "path": path, + }).Debugf("Authenticated API request") return &user } diff --git a/service/internal/api/api.go b/service/internal/api/api.go index d467bcb..280b386 100644 --- a/service/internal/api/api.go +++ b/service/internal/api/api.go @@ -662,7 +662,9 @@ func (api *oliveTinAPI) EventStream(ctx ctx.Context, req *connect.Request[apiv1. AuthenticatedUser: user, } - log.Infof("EventStream: client connected: %v", client.AuthenticatedUser.Username) + log.WithFields(log.Fields{ + "authenticatedUser": user.Username, + }).Debugf("EventStream: client connected") api.streamingClientsMutex.Lock() api.streamingClients[client] = struct{}{} @@ -814,7 +816,7 @@ func (api *oliveTinAPI) buildRootDashboards(user *acl.AuthenticatedUser, dashboa func (api *oliveTinAPI) addDefaultDashboardIfNeeded(rootDashboards *[]string, rr *DashboardRenderRequest) { defaultDashboard := buildDefaultDashboard(rr) if defaultDashboard != nil && len(defaultDashboard.Contents) > 0 { - log.Infof("defaultDashboard: %+v", defaultDashboard.Contents) + log.Tracef("defaultDashboard: %+v", defaultDashboard.Contents) *rootDashboards = append(*rootDashboards, "Actions") } } diff --git a/service/internal/executor/executor_actions.go b/service/internal/executor/executor_actions.go index 36327ea..053af80 100644 --- a/service/internal/executor/executor_actions.go +++ b/service/internal/executor/executor_actions.go @@ -53,7 +53,9 @@ func (e *Executor) RebuildActionMap() { findDashboardActionTitles(req) - log.Infof("dashboardActionTitles: %v", req.DashboardActionTitles) + log.WithFields(log.Fields{ + "titles": req.DashboardActionTitles, + }).Trace("dashboardActionTitles") for configOrder, action := range e.Cfg.Actions { if action.Entity != "" { diff --git a/service/internal/httpservers/singleFrontend.go b/service/internal/httpservers/singleFrontend.go index e7627e6..e42e493 100644 --- a/service/internal/httpservers/singleFrontend.go +++ b/service/internal/httpservers/singleFrontend.go @@ -53,7 +53,11 @@ func StartSingleHTTPFrontend(cfg *config.Config, ex *executor.Executor) { r.URL.Path = apiPath + fn - log.Debugf("SingleFrontend HTTP API Req URL after rewrite: %v", r.URL.Path) + log.WithFields(log.Fields{ + "path": r.URL.Path, + }).Tracef("SingleFrontend HTTP API Req URL after rewrite") + + logDebugRequest(cfg, "api", r) apiHandler.ServeHTTP(w, r) })) diff --git a/service/internal/httpservers/webuiServer.go b/service/internal/httpservers/webuiServer.go index 86ba263..7a0aa8f 100644 --- a/service/internal/httpservers/webuiServer.go +++ b/service/internal/httpservers/webuiServer.go @@ -45,7 +45,7 @@ func (s *webUIServer) handleWebui(w http.ResponseWriter, r *http.Request) { http.ServeFile(w, r, path.Join(s.webuiDir, "index.html")) } else { - log.Infof("Serving webui from %s for %s", s.webuiDir, r.URL.Path) + log.Tracef("Serving webui from %s for %s", s.webuiDir, r.URL.Path) http.ServeFile(w, r, path.Join(s.webuiDir, r.URL.Path)) // http.StripPrefix(dirName, http.FileServer(http.Dir(s.webuiDir))).ServeHTTP(w, r) } diff --git a/service/main.go b/service/main.go index f1dd357..dd4eac9 100644 --- a/service/main.go +++ b/service/main.go @@ -151,10 +151,17 @@ func initConfig(configDir string) { for _, directory := range directories { configPath := getConfigPath(directory) - log.Debugf("Checking config path: %s", configPath) - + found := true if _, err := os.Stat(configPath); err != nil { - log.Debugf("Config file not found at %s: %v", configPath, err) + found = false + } + + log.WithFields(log.Fields{ + "configPath": configPath, + "found": found, + }).Debug("Checking config path") + + if !found { continue }