mirror of
				https://github.com/zadam/trilium.git
				synced 2025-11-03 20:06:08 +01:00 
			
		
		
		
	logging improvements
This commit is contained in:
		@@ -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);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -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);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -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) {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -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
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user