Skip to content

Build your personal knowledge base with Trilium Notes

logging improvements

zadamea56bb772aa8
diff --git a/src/routes/api/clipper.js b/src/routes/api/clipper.js
index db6a2068f7..d6f1318433 100644
--- a/src/routes/api/clipper.js
+++ b/src/routes/api/clipper.js
@@ -138,7 +138,7 @@ function processContent(images, note, content) {
value: imageNote.noteId
}).save();
- console.log(`Replacing ${imageId} with ${url}`);
+ log.info(`Replacing ${imageId} with ${url} in note ${note.noteId}`);
rewrittenContent = utils.replaceAll(rewrittenContent, imageId, url);
}
diff --git a/src/services/attributes.js b/src/services/attributes.js
index 5fcc121bdf..3ddd412235 100644
--- a/src/services/attributes.js
+++ b/src/services/attributes.js
@@ -20,7 +20,7 @@ function getNotesWithLabel(name, value) {
// TODO: should be in search service
/** @returns {Note|null} */
-function getNoteWithLabel(name, value) {
+function getNoteWithLabel(name, value = undefined) {
// optimized version (~20 times faster) without using normal search, useful for e.g. finding date notes
const attrs = becca.findAttributes('label', name);
diff --git a/src/services/cloning.js b/src/services/cloning.js
index 9fce5234c5..8685d65967 100644
--- a/src/services/cloning.js
+++ b/src/services/cloning.js
@@ -9,6 +9,7 @@ const TaskContext = require("./task_context");
const utils = require('./utils');
const becca = require("../becca/becca");
const beccaService = require("../becca/becca_service");
+const log = require("./log");
function cloneNoteToNote(noteId, parentNoteId, prefix) {
if (parentNoteId === 'share') {
@@ -73,6 +74,8 @@ function ensureNoteIsPresentInParent(noteId, parentNoteId, prefix) {
prefix: prefix,
isExpanded: 0
}).save();
+
+ log.info(`Creating new branch between child '${noteId}' and parent '${parentNoteId}'`);
}
function ensureNoteIsAbsentFromParent(noteId, parentNoteId) {
diff --git a/src/services/image.js b/src/services/image.js
index c2ee26690c..4c64e8ee55 100644
--- a/src/services/image.js
+++ b/src/services/image.js
@@ -85,7 +85,7 @@ function updateImage(noteId, uploadBuffer, originalName) {
}
function saveImage(parentNoteId, uploadBuffer, originalName, shrinkImageSwitch, trimFilename = false) {
- log.info(`Saving image ${originalName}`);
+ log.info(`Saving image ${originalName} into parent ${parentNoteId}`);
if (trimFilename && originalName.length > 40) {
// https://github.com/zadam/trilium/issues/2307