mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-11 08:07:26 +02:00
refactor: unify log format with new logger utility (#5994)
Co-authored-by: sebastienlorber <lorber.sebastien@gmail.com>
This commit is contained in:
parent
faef753730
commit
770418f8d2
66 changed files with 717 additions and 650 deletions
|
@ -6,7 +6,6 @@
|
|||
*/
|
||||
|
||||
import fs from 'fs-extra';
|
||||
import chalk from 'chalk';
|
||||
import path from 'path';
|
||||
import readingTime from 'reading-time';
|
||||
import {keyBy, mapValues} from 'lodash';
|
||||
|
@ -33,6 +32,7 @@ import {
|
|||
import {LoadContext} from '@docusaurus/types';
|
||||
import {validateBlogPostFrontMatter} from './blogFrontMatter';
|
||||
import {AuthorsMap, getAuthorsMap, getBlogPostAuthors} from './authors';
|
||||
import logger from '@docusaurus/logger';
|
||||
|
||||
export function truncate(fileString: string, truncateMarker: RegExp): string {
|
||||
return fileString.split(truncateMarker, 1).shift()!;
|
||||
|
@ -151,11 +151,7 @@ async function processBlogSourceFile(
|
|||
}
|
||||
|
||||
if (frontMatter.id) {
|
||||
console.warn(
|
||||
chalk.yellow(
|
||||
`"id" header option is deprecated in ${blogSourceRelative} file. Please use "slug" option instead.`,
|
||||
),
|
||||
);
|
||||
logger.warn`name=${'id'} header option is deprecated in path=${blogSourceRelative} file. Please use name=${'slug'} option instead.`;
|
||||
}
|
||||
|
||||
const parsedBlogFileName = parseBlogFileName(blogSourceRelative);
|
||||
|
@ -276,11 +272,7 @@ export async function generateBlogPosts(
|
|||
authorsMap,
|
||||
);
|
||||
} catch (e) {
|
||||
console.error(
|
||||
chalk.red(
|
||||
`Processing of blog source file failed for path "${blogSourceFile}"`,
|
||||
),
|
||||
);
|
||||
logger.error`Processing of blog source file failed for path path=${blogSourceFile}.`;
|
||||
throw e;
|
||||
}
|
||||
}),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue