diff --git a/cmd/main.go b/cmd/main.go index 7648822..8839763 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -5,11 +5,13 @@ import ( "os" "github.com/KristianJBorgwarth/dendrite.daemon/core/handlers" + "github.com/KristianJBorgwarth/dendrite.daemon/core/logging" "github.com/KristianJBorgwarth/dendrite.daemon/core/server" _ "modernc.org/sqlite" ) func main() { + logging.Init() server := server.NewServer() server.RegisterHandler("initialize", handlers.NewInitializeHandler()) diff --git a/core/frontmatter/parser.go b/core/frontmatter/parser.go index ea834c9..9bcb523 100644 --- a/core/frontmatter/parser.go +++ b/core/frontmatter/parser.go @@ -3,6 +3,8 @@ package frontmatter import ( "bytes" "errors" + "log/slog" + "gopkg.in/yaml.v3" ) @@ -19,6 +21,7 @@ func ParseTags(file []byte) ([]string, error) { if err != nil { return nil, err } + slog.Debug("parsed front matter", "fm", fm) return fm.Tags, nil } @@ -33,6 +36,7 @@ func parseFrontMatter(file []byte) (*FrontMatter, error) { if idx := bytes.Index(content, []byte("---")); idx != -1 { content = bytes.TrimSpace(content[:idx]) } + slog.Debug("yaml content to parse", "content", string(content)) var fm FrontMatter if err := yaml.Unmarshal(content, &fm); err != nil { diff --git a/core/handlers/create_note_handler.go b/core/handlers/create_note_handler.go index 66abaab..10cd3cd 100644 --- a/core/handlers/create_note_handler.go +++ b/core/handlers/create_note_handler.go @@ -40,6 +40,8 @@ func (h *CreateNoteHandler) Handle(ctx context.Context, raw json.RawMessage) (an return nil, err } + slog.Debug("rendered template", "data", string(data)) + tags, err := frontmatter.ParseTags(data) if err != nil { return nil, err diff --git a/core/logging/logger.go b/core/logging/logger.go index c8ce991..a26e39c 100644 --- a/core/logging/logger.go +++ b/core/logging/logger.go @@ -2,7 +2,6 @@ package logging import ( - "io" "log/slog" "os" ) @@ -13,9 +12,7 @@ func Init() { panic(err) } - writer := io.MultiWriter(os.Stdout, logFile) - - handler := slog.NewTextHandler(writer, &slog.HandlerOptions{ + handler := slog.NewTextHandler(logFile, &slog.HandlerOptions{ Level: slog.LevelDebug, }) diff --git a/dendrite b/dendrite index 2eff99a..ec9a22a 100755 Binary files a/dendrite and b/dendrite differ