Removes excessive logging
Removes console log statements used for debugging during development, resulting in cleaner output and improved performance in production.
This commit is contained in:
5 files changed
+1
-44
No files matched your search
@@ -225,7 +225,6 @@ export class MarkdownPreprocessor {
|
||||
if (this.noteTitle) {
|
||||
const yaml = require('js-yaml');
|
||||
const titleFrontmatter = yaml.dump({ title: this.noteTitle });
|
||||
console.log('Replacing frontmatter with title:', titleFrontmatter);
|
||||
processedContent = `---\n${titleFrontmatter}---\n${parsed.content}`;
|
||||
} else {
|
||||
processedContent = parsed.content;
|
||||
@@ -252,7 +251,6 @@ export class MarkdownPreprocessor {
|
||||
if (this.noteTitle) {
|
||||
const yaml = require('js-yaml');
|
||||
const titleFrontmatter = yaml.dump({ title: this.noteTitle });
|
||||
console.log('Adding title frontmatter:', titleFrontmatter);
|
||||
return `---\n${titleFrontmatter}---\n${content}`;
|
||||
} else {
|
||||
return content;
|
||||
@@ -345,8 +343,6 @@ export class MarkdownPreprocessor {
|
||||
return '';
|
||||
}
|
||||
|
||||
console.log('MarkdownPreprocessor: Formatting frontmatter for display:', frontmatter);
|
||||
|
||||
const lines: string[] = [];
|
||||
lines.push('**Document Information**');
|
||||
lines.push('');
|
||||
@@ -415,13 +411,11 @@ export class MarkdownPreprocessor {
|
||||
// Add a line break after the label for regular values
|
||||
lines.push(`**${formattedKey}:**\n${formattedValue}`);
|
||||
}
|
||||
console.log(`MarkdownPreprocessor: Formatted ${key} ->`, JSON.stringify(formattedValue));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Join with double newlines to ensure proper spacing between fields
|
||||
const result = lines.join('\n\n');
|
||||
console.log('MarkdownPreprocessor: Final formatted frontmatter:', JSON.stringify(result));
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -100,7 +100,6 @@ export class PandocTypstConverter {
|
||||
await this.ensureTempDirectory();
|
||||
const tempInputPath = path.join(this.tempDir!, `temp-${Date.now()}.md`);
|
||||
|
||||
console.log('PandocTypstConverter: Writing markdown content to temp file:', JSON.stringify(content.substring(0, 1000)));
|
||||
await fsPromises.writeFile(tempInputPath, content, 'utf-8');
|
||||
|
||||
// Merge options
|
||||
@@ -149,7 +148,6 @@ export class PandocTypstConverter {
|
||||
|
||||
for (const pdfEmbed of processedResult.metadata.pdfEmbeds) {
|
||||
try {
|
||||
console.log(`Export: Processing PDF embed: ${pdfEmbed.originalPath}`);
|
||||
|
||||
// Resolve full path to the PDF
|
||||
const fullPdfPath = path.resolve(vaultBasePath, pdfEmbed.sanitizedPath);
|
||||
@@ -198,7 +196,6 @@ export class PandocTypstConverter {
|
||||
// Replace marker with output
|
||||
processedResult.content = processedResult.content.replace(pdfEmbed.marker, combinedOutput);
|
||||
|
||||
console.log(`Export: Successfully converted PDF: ${pdfEmbed.fileName} -> ${path.basename(conversionResult.imagePath)}`);
|
||||
|
||||
} else {
|
||||
console.error(`Export: PDF conversion failed: ${conversionResult.error}`);
|
||||
@@ -311,7 +308,6 @@ export class PandocTypstConverter {
|
||||
for (const attachPath of commonAttachmentPaths) {
|
||||
if (fs.existsSync(attachPath)) {
|
||||
args.push('--resource-path', attachPath);
|
||||
console.log('Added resource path:', attachPath);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -326,7 +322,6 @@ export class PandocTypstConverter {
|
||||
// Use cached resource paths
|
||||
for (const cachedPath of this.resourcePathCache) {
|
||||
args.push('--resource-path', cachedPath);
|
||||
console.log('Added cached resource path:', cachedPath);
|
||||
}
|
||||
} else {
|
||||
// Cache is invalid or expired, perform fresh scan
|
||||
@@ -356,7 +351,6 @@ export class PandocTypstConverter {
|
||||
if (hasImages) {
|
||||
foundResourcePaths.push(itemPath);
|
||||
args.push('--resource-path', itemPath);
|
||||
console.log('Added note-specific resource path:', itemPath);
|
||||
}
|
||||
} catch (e) {
|
||||
// Ignore directories we can't read
|
||||
@@ -368,7 +362,6 @@ export class PandocTypstConverter {
|
||||
this.resourcePathCache = foundResourcePaths;
|
||||
this.resourcePathCacheTimestamp = now;
|
||||
this.resourcePathCacheVaultPath = this.pandocOptions.vaultBasePath;
|
||||
console.log(`Export: Cached ${foundResourcePaths.length} resource paths for future use`);
|
||||
} catch (e) {
|
||||
console.warn('Could not scan vault for attachment directories:', e);
|
||||
}
|
||||
@@ -381,7 +374,6 @@ export class PandocTypstConverter {
|
||||
const fs = require('fs');
|
||||
const absolutePluginDir = this.pandocOptions.pluginDir || '';
|
||||
const wrapperPath = path.resolve(absolutePluginDir, 'templates', 'universal-wrapper.pandoc.typ');
|
||||
console.log('Universal wrapper path:', wrapperPath);
|
||||
|
||||
// Verify wrapper exists
|
||||
if (!fs.existsSync(wrapperPath)) {
|
||||
@@ -560,7 +552,6 @@ export class PandocTypstConverter {
|
||||
const timeout = this.pandocOptions.timeout || 60000;
|
||||
|
||||
// Log the exact command being executed for debugging
|
||||
console.log('Executing Pandoc command:', pandocPath, args.join(' '));
|
||||
|
||||
progressCallback?.('Starting Pandoc process...', 40);
|
||||
|
||||
@@ -569,12 +560,10 @@ export class PandocTypstConverter {
|
||||
|
||||
if (this.pandocOptions.vaultBasePath) {
|
||||
workingDir = this.pandocOptions.vaultBasePath;
|
||||
console.log('Pandoc working directory (vault):', workingDir);
|
||||
} else {
|
||||
// Fallback to plugin directory
|
||||
const pluginDir = this.pandocOptions.pluginDir || process.cwd();
|
||||
workingDir = pluginDir;
|
||||
console.log('Pandoc working directory (plugin fallback):', workingDir);
|
||||
}
|
||||
|
||||
// Augment PATH to include common binary locations
|
||||
@@ -615,7 +604,6 @@ export class PandocTypstConverter {
|
||||
pandocProcess.stderr?.on('data', (data: Buffer) => {
|
||||
const output = data.toString();
|
||||
stderr += output;
|
||||
console.log('Pandoc stderr:', output);
|
||||
|
||||
// Parse progress information from stderr if available
|
||||
this.parseProgressFromOutput(output, progressCallback);
|
||||
@@ -649,7 +637,6 @@ export class PandocTypstConverter {
|
||||
// Handle process errors
|
||||
pandocProcess.on('error', (error: Error) => {
|
||||
clearTimeout(timeoutHandle);
|
||||
console.log('Pandoc process error:', error);
|
||||
resolve({
|
||||
success: false,
|
||||
error: `Failed to start Pandoc process: ${error.message}`,
|
||||
|
||||
@@ -149,8 +149,6 @@ export class PdfToImageConverter {
|
||||
|
||||
const pdf2imgPath = path.join(pluginDir, 'node_modules', '.bin', 'pdf2img');
|
||||
|
||||
console.log(`Plugin directory: ${pluginDir}`);
|
||||
console.log(`PDF2IMG path: ${pdf2imgPath}`);
|
||||
|
||||
// Check if the binary exists
|
||||
const fs2 = require('fs');
|
||||
@@ -173,7 +171,6 @@ export class PdfToImageConverter {
|
||||
'--pages', '1' // Only convert the first page
|
||||
].join(' ');
|
||||
|
||||
console.log(`PDF conversion command: ${cliCommand}`);
|
||||
|
||||
try {
|
||||
// Set environment variables to ensure node can be found
|
||||
@@ -191,7 +188,6 @@ export class PdfToImageConverter {
|
||||
const result = await execAsync(cliCommand, {
|
||||
env
|
||||
});
|
||||
console.log(`PDF conversion stdout: ${result.stdout}`);
|
||||
if (result.stderr) {
|
||||
console.warn(`PDF conversion stderr: ${result.stderr}`);
|
||||
}
|
||||
@@ -214,12 +210,10 @@ export class PdfToImageConverter {
|
||||
// Debug: List what files are actually in the output directory
|
||||
try {
|
||||
const files = await fs.readdir(outputDir);
|
||||
console.log(`Files in output directory (${outputDir}):`, files);
|
||||
|
||||
// Look for any PNG files that might match
|
||||
const pngFiles = files.filter(f => f.endsWith('.png'));
|
||||
if (pngFiles.length > 0) {
|
||||
console.log(`Found PNG files:`, pngFiles);
|
||||
|
||||
// Try to find a file that matches the pattern (with or without exact name)
|
||||
// pdf2img might sanitize filenames differently
|
||||
@@ -234,7 +228,6 @@ export class PdfToImageConverter {
|
||||
|
||||
if (matchingFile) {
|
||||
actualOutputPath = path.join(outputDir, matchingFile);
|
||||
console.log(`Using found PNG file: ${actualOutputPath}`);
|
||||
}
|
||||
}
|
||||
} catch (listError) {
|
||||
|
||||
@@ -62,7 +62,6 @@ export class TempDirectoryManager {
|
||||
for (const file of files) {
|
||||
this.fs.unlinkSync(this.path.join(tempDir, file));
|
||||
}
|
||||
console.log(`Export: Cleaned up ${type === 'images' ? 'temp-images' : 'temp-pandoc'} directory`);
|
||||
return true;
|
||||
}
|
||||
} catch (error) {
|
||||
|
||||
Reference in new issue
Block a user