logging improvements

This commit is contained in:
zadam 2022-02-20 12:33:50 +01:00
parent 9f33791922
commit ea56bb772a
4 changed files with 6 additions and 3 deletions

View File

@ -138,7 +138,7 @@ function processContent(images, note, content) {
value: imageNote.noteId value: imageNote.noteId
}).save(); }).save();
console.log(`Replacing ${imageId} with ${url}`); log.info(`Replacing ${imageId} with ${url} in note ${note.noteId}`);
rewrittenContent = utils.replaceAll(rewrittenContent, imageId, url); rewrittenContent = utils.replaceAll(rewrittenContent, imageId, url);
} }

View File

@ -20,7 +20,7 @@ function getNotesWithLabel(name, value) {
// TODO: should be in search service // TODO: should be in search service
/** @returns {Note|null} */ /** @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 // optimized version (~20 times faster) without using normal search, useful for e.g. finding date notes
const attrs = becca.findAttributes('label', name); const attrs = becca.findAttributes('label', name);

View File

@ -9,6 +9,7 @@ const TaskContext = require("./task_context");
const utils = require('./utils'); const utils = require('./utils');
const becca = require("../becca/becca"); const becca = require("../becca/becca");
const beccaService = require("../becca/becca_service"); const beccaService = require("../becca/becca_service");
const log = require("./log");
function cloneNoteToNote(noteId, parentNoteId, prefix) { function cloneNoteToNote(noteId, parentNoteId, prefix) {
if (parentNoteId === 'share') { if (parentNoteId === 'share') {
@ -73,6 +74,8 @@ function ensureNoteIsPresentInParent(noteId, parentNoteId, prefix) {
prefix: prefix, prefix: prefix,
isExpanded: 0 isExpanded: 0
}).save(); }).save();
log.info(`Creating new branch between child '${noteId}' and parent '${parentNoteId}'`);
} }
function ensureNoteIsAbsentFromParent(noteId, parentNoteId) { function ensureNoteIsAbsentFromParent(noteId, parentNoteId) {

View File

@ -85,7 +85,7 @@ function updateImage(noteId, uploadBuffer, originalName) {
} }
function saveImage(parentNoteId, uploadBuffer, originalName, shrinkImageSwitch, trimFilename = false) { 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) { if (trimFilename && originalName.length > 40) {
// https://github.com/zadam/trilium/issues/2307 // https://github.com/zadam/trilium/issues/2307