Skip to content

Commit

Permalink
chore: use console for logging
Browse files Browse the repository at this point in the history
  • Loading branch information
snitin315 committed Aug 11, 2020
1 parent 4fe8045 commit 1343131
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
9 changes: 7 additions & 2 deletions packages/webpack-cli/lib/utils/logger.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
const { getLogger } = require('webpack/lib/logging/runtime');
const { red, cyan, yellow } = require('colorette');

module.exports = getLogger('webpack-cli');
module.exports = {
error: (val, arg) => console.error(red(val), arg),
warn: (val, arg) => console.warn(yellow(val), arg),
info: (val, arg) => console.info(cyan(val), arg),
log: (val, arg) => console.log(val, arg),
};
2 changes: 1 addition & 1 deletion test/hot/hot-flag.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ describe('--hot flag', () => {
it('should warn when --hot and --no-hot both are passed', (done) => {
const { stderr, stdout } = run(__dirname, ['--no-hot', '--hot']);
expect(stderr).toContain(
'[webpack-cli] You provided both --hot and --no-hot. We will use only the last of these flags that you provided in your CLI arguments',
'You provided both --hot and --no-hot. We will use only the last of these flags that you provided in your CLI arguments',
);
expect(stdout).toContain('HotModuleReplacementPlugin');

Expand Down
2 changes: 1 addition & 1 deletion test/no-hot/no-hot.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ describe('no-hot flag', () => {
it('should warn when --hot and --no-hot both are passed', (done) => {
const { stderr, stdout } = run(__dirname, ['--hot', '--no-hot']);
expect(stderr).toContain(
'[webpack-cli] You provided both --hot and --no-hot. We will use only the last of these flags that you provided in your CLI arguments',
'You provided both --hot and --no-hot. We will use only the last of these flags that you provided in your CLI arguments',
);
expect(stdout).toBeTruthy();

Expand Down

0 comments on commit 1343131

Please sign in to comment.