chore: add debug log for registration of pages and components

This commit is contained in:
Bastien Riviere 2023-12-18 18:37:34 +01:00
parent 9ae75214eb
commit 07567448ab
Signed by: babariviere
GPG key ID: 4E5F0839249F162E

View file

@ -38,11 +38,13 @@ func ParseTemplates(f fs.FS, fm template.FuncMap) (*RendererManager, error) {
components = append(components, path)
if strings.HasPrefix(path, "components") {
p := strings.TrimSuffix(strings.TrimPrefix(path, "components"), ".gohtml")
p := strings.TrimSuffix(strings.TrimPrefix(path, "components/"), ".gohtml")
tmpl, err := template.New("").Funcs(fm).ParseFS(f, path)
if err != nil {
return err
}
slog.Debug("registering new component", "name", p, "path", path)
rm.components[p] = Renderer{
tmpl: tmpl,
}
@ -81,6 +83,7 @@ func ParseTemplates(f fs.FS, fm template.FuncMap) (*RendererManager, error) {
}
name := strings.TrimPrefix(strings.TrimSuffix(path, ".gohtml"), "pages/")
slog.Debug("registering new page", "name", name, "path", path)
rm.pages[name] = Renderer{
tmpl: tmpl,
}