From 5034e111eba406f0c1ea713fd8c03a18df9047b0 Mon Sep 17 00:00:00 2001 From: Alexander Kucera Date: Sat, 8 Nov 2025 18:37:14 +0100 Subject: [PATCH] Improves logging for frontmatter processing Enhances debugging output by including content length in log messages, assisting in monitoring and troubleshooting frontmatter parsing issues efficiently. Reduces redundant debug information, focusing on concise logging to maintain readability and effectiveness in error analysis. --- src/converters/preprocessors/FrontmatterProcessor.ts | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/converters/preprocessors/FrontmatterProcessor.ts b/src/converters/preprocessors/FrontmatterProcessor.ts index 1e20d4a..8fce89e 100644 --- a/src/converters/preprocessors/FrontmatterProcessor.ts +++ b/src/converters/preprocessors/FrontmatterProcessor.ts @@ -44,11 +44,10 @@ export class FrontmatterProcessor { } // Use gray-matter for robust frontmatter parsing - + // Add debugging to see what's being parsed - console.debug('FrontmatterProcessor: Attempting to parse content with frontmatter pattern detected'); - console.debug('First 200 chars:', content.substring(0, 200)); - + console.debug('FrontmatterProcessor: Attempting to parse content with frontmatter pattern detected', `(content length: ${content.length})`); + const parsed = matter(content); if (parsed.data && Object.keys(parsed.data).length > 0) { @@ -150,8 +149,7 @@ export class FrontmatterProcessor { } } catch (error: unknown) { const errorMessage = error instanceof Error ? error.message : String(error); - console.error('FrontmatterProcessor: gray-matter failed with error:', errorMessage); - console.error('Content being parsed (first 500 chars):', content.substring(0, 500)); + console.error('FrontmatterProcessor: gray-matter failed with error:', errorMessage, `(content length: ${content.length})`); result.warnings.push(`Failed to parse frontmatter with gray-matter: ${errorMessage}`); // Fallback to simple regex-based parsing