Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:bug: Log notebook document initialization only when created https://github.com/siyuan-note/siyuan/issues/18266

Danielda4ecdb1fdc7
diff --git a/kernel/model/box_doc.go b/kernel/model/box_doc.go
index 6f40cce05f..f72b081fd0 100644
--- a/kernel/model/box_doc.go
+++ b/kernel/model/box_doc.go
@@ -144,7 +144,7 @@ func ensureBoxDoc0(boxID string) (boxDocID string, err error) {
if err != nil {
return "", err
}
- changed := false
+ created, changed := false, false
if "" == boxDocID {
boxDocID = boxID
if box.Exist(boxDocPath(boxDocID)) || nil != treenode.GetBlockTree(boxDocID) || "" != findUnindexedTreePathInAllBoxes(boxDocID) {
@@ -153,6 +153,7 @@ func ensureBoxDoc0(boxID string) (boxDocID string, err error) {
if err = createBoxDoc(box, boxDocID); err != nil {
return "", err
}
+ created = true
changed = true
} else {
indexBoxDocIfNeeded(boxID, boxDocID)
@@ -171,7 +172,9 @@ func ensureBoxDoc0(boxID string) (boxDocID string, err error) {
if changed {
IncSync()
}
- logging.LogInfof("initialized box document [box=%s, id=%s]", boxID, boxDocID)
+ if created {
+ logging.LogInfof("initialized box document [box=%s, id=%s]", boxID, boxDocID)
+ }
return
}