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.
This commit is contained in:
1 file changed
+4
-6
@@ -44,11 +44,10 @@ export class FrontmatterProcessor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Use gray-matter for robust frontmatter parsing
|
// Use gray-matter for robust frontmatter parsing
|
||||||
|
|
||||||
// Add debugging to see what's being parsed
|
// Add debugging to see what's being parsed
|
||||||
console.debug('FrontmatterProcessor: Attempting to parse content with frontmatter pattern detected');
|
console.debug('FrontmatterProcessor: Attempting to parse content with frontmatter pattern detected', `(content length: ${content.length})`);
|
||||||
console.debug('First 200 chars:', content.substring(0, 200));
|
|
||||||
|
|
||||||
const parsed = matter(content);
|
const parsed = matter(content);
|
||||||
|
|
||||||
if (parsed.data && Object.keys(parsed.data).length > 0) {
|
if (parsed.data && Object.keys(parsed.data).length > 0) {
|
||||||
@@ -150,8 +149,7 @@ export class FrontmatterProcessor {
|
|||||||
}
|
}
|
||||||
} catch (error: unknown) {
|
} catch (error: unknown) {
|
||||||
const errorMessage = error instanceof Error ? error.message : String(error);
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
||||||
console.error('FrontmatterProcessor: gray-matter failed with error:', errorMessage);
|
console.error('FrontmatterProcessor: gray-matter failed with error:', errorMessage, `(content length: ${content.length})`);
|
||||||
console.error('Content being parsed (first 500 chars):', content.substring(0, 500));
|
|
||||||
result.warnings.push(`Failed to parse frontmatter with gray-matter: ${errorMessage}`);
|
result.warnings.push(`Failed to parse frontmatter with gray-matter: ${errorMessage}`);
|
||||||
|
|
||||||
// Fallback to simple regex-based parsing
|
// Fallback to simple regex-based parsing
|
||||||
|
|||||||
Reference in new issue
Block a user