mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-23 05:57:05 +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
|
@ -5,7 +5,7 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import chalk from 'chalk';
|
||||
import logger from '@docusaurus/logger';
|
||||
import path from 'path';
|
||||
import {createHash} from 'crypto';
|
||||
import {camelCase, mapValues} from 'lodash';
|
||||
|
@ -369,13 +369,13 @@ export function reportMessage(
|
|||
case 'ignore':
|
||||
break;
|
||||
case 'log':
|
||||
console.log(chalk.bold.blue('info ') + chalk.blue(message));
|
||||
logger.info(message);
|
||||
break;
|
||||
case 'warn':
|
||||
console.warn(chalk.bold.yellow('warn ') + chalk.yellow(message));
|
||||
logger.warn(message);
|
||||
break;
|
||||
case 'error':
|
||||
console.error(chalk.bold.red('error ') + chalk.red(message));
|
||||
logger.error(message);
|
||||
break;
|
||||
case 'throw':
|
||||
throw new Error(message);
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import chalk from 'chalk';
|
||||
import logger from '@docusaurus/logger';
|
||||
import fs from 'fs-extra';
|
||||
import matter from 'gray-matter';
|
||||
|
||||
|
@ -166,10 +166,8 @@ export function parseMarkdownString(
|
|||
excerpt,
|
||||
};
|
||||
} catch (e) {
|
||||
console.error(
|
||||
chalk.red(`Error while parsing Markdown frontmatter.
|
||||
This can happen if you use special characters in frontmatter values (try using double quotes around that value).`),
|
||||
);
|
||||
logger.error(`Error while parsing Markdown frontmatter.
|
||||
This can happen if you use special characters in frontmatter values (try using double quotes around that value).`);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue