fix: Various log noise and spam (#698)

This commit is contained in:
James Read 2025-11-06 23:48:11 +00:00 committed by GitHub
commit 4006fd485d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 31 additions and 9 deletions

View File

@ -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
}

View File

@ -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")
}
}

View File

@ -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 != "" {

View File

@ -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)
}))

View File

@ -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)
}

View File

@ -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
}