refactor: framework modules log through diary components

- Each module logs through diary.For(<package>): cabana, lagoon, attach, cooler, postcard, beachcomber, lighthouse, centrifugo, flare, phrasebook, wristband, bouncer
- App-published *slog.Logger overrides stay first; messages and attributes unchanged
- sunscreen: InstallDefault documented as the compatibility entry point; diary wraps every channel
- READMEs list diary as a dependency; logging docs: plugins use diary.For
This commit is contained in:
Jakub Zych
2026-10-21 11:58:22 +02:00
parent 71b99317ad
commit 44291adcca
53 changed files with 185 additions and 130 deletions

View File

@@ -6,7 +6,6 @@ import (
"errors"
"fmt"
"io"
"log/slog"
"net/http"
"reflect"
"slices"
@@ -779,7 +778,7 @@ func (s *service) formSchema(w http.ResponseWriter, r *http.Request) {
// A permission editor's options are the controller's answer for this
// administrator (D-16); kept is this request's own slice.
if err := localizePermissionOptions(r.Context(), s.translator(), cc, kept); err != nil {
slog.Error("cabana: permission options failed", "controller", controllerID(cc), "error", err)
moduleLog.Error("cabana: permission options failed", "controller", controllerID(cc), "error", err)
WriteError(w, http.StatusInternalServerError, "error", msgServerError)
return
}
@@ -1046,7 +1045,7 @@ func (s *service) enabledContentLocales(ctx context.Context) []string {
}
codes, err := writer.EnabledLocales(ctx, db)
if err != nil {
slog.Error("cabana: enabled locales", "error", err)
moduleLog.Error("cabana: enabled locales", "error", err)
return nil
}
// The SPA opens every ML control on the first code, and the default
@@ -1054,7 +1053,7 @@ func (s *service) enabledContentLocales(ctx context.Context) []string {
// and the other codes keep the writer's order.
def, err := writer.DefaultLocale(ctx, db)
if err != nil {
slog.Error("cabana: default locale", "error", err)
moduleLog.Error("cabana: default locale", "error", err)
return codes
}
if i := slices.Index(codes, def); def != "" && i > 0 {